Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/ProjectSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const BrandIcon = () => (
export const ProjectSelector = () => {
const { orgName, projectName } = useAllParams('orgName')

const { data } = useApiQuery('projectList', { orgName, limit: 20 })
const { data } = useApiQuery('projectList', { orgName, limit: 10 })
Copy link
Collaborator Author

@david-crespo david-crespo Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the same as the other projectList requests for accurate deduping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like we need a less flaky way to ensure these stay in sync.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wholeheartedly agree, I hate it. I have a sneaky idea: if we take the limit param off of the request in QueryTable (unless it's specified through a prop, maybe) then we can rely on the default page size practically everywhere and we avoid syncing it by not using the limit param almost anywhere.


// filter out current project if there is one. if there isn't one, it'll be
// undefined and it won't match any
Expand Down
10 changes: 7 additions & 3 deletions app/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { DataBrowserRouter, Navigate, Route } from 'react-router-dom'
import { DataBrowserRouter, Navigate, Route, redirect } from 'react-router-dom'

import type { CrumbFunc } from './components/Breadcrumbs'
import { RouterDataErrorBoundary } from './components/ErrorBoundary'
Expand Down Expand Up @@ -72,10 +72,14 @@ export const Router = () => (
<Route index element={<Navigate to="/orgs" replace />} />

{/* These are done here instead of nested so we don't flash a layout on 404s */}
<Route path="/orgs/:orgName" element={<Navigate to="projects" replace />} />
<Route
path="/orgs/:orgName"
// redirect() doesn't do relative nav so we have to construct the path
loader={({ request }) => redirect(`${new URL(request.url).pathname}/projects`)}
/>
<Route
path="/orgs/:orgName/projects/:projectName"
element={<Navigate to="instances" replace />}
loader={({ request }) => redirect(`${new URL(request.url).pathname}/instances`)}
/>

<Route path="orgs" errorElement={<RouterDataErrorBoundary />}>
Expand Down