Skip to content

Commit

Permalink
chore: Enable one future react-router-dom flag
Browse files Browse the repository at this point in the history
react-router-dom was writing warning messages in the console about
upcoming features in v7 and suggested opting in early. I tried turning
them on, but couldn't get custom tabs navigation working properly with
v7_relativeSplatPath enabled, so decided to keep it off for now. (Plus
it might also break something in consuming apps.)

v7_startTransition only needed an update in one place in a test where we
need to await for the UI to update, so kept it on. It also shouldn't
require any changes in consuming application code, though possibly
something in tests like we needed here.

Related docs:

- https://reactrouter.com/en/6.28.0/upgrading/future#v7_relativesplatpath

- https://reactrouter.com/en/6.28.0/upgrading/future#v7_starttransition

Signed-off-by: Harri Lehtola <[email protected]>
  • Loading branch information
peruukki committed Nov 16, 2024
1 parent 27d52a9 commit 4c235ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ui/src/FeastUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const FeastUI = ({ reactQueryClient, feastUIConfigs }: FeastUIProps) => {
const queryClient = reactQueryClient || defaultQueryClient;

return (
<BrowserRouter>
// Disable v7_relativeSplatPath: custom tab routes don't currently work with it
<BrowserRouter future={{ v7_relativeSplatPath: false, v7_startTransition: true }}>
<QueryClientProvider client={queryClient}>
<QueryParamProvider adapter={ReactRouter6Adapter}>
<FeastUISansProviders feastUIConfigs={feastUIConfigs} />
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/ProjectSelector.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test("in a full App render, it shows the right initial project", async () => {
name: "Top Level",
});

within(topLevelNavigation).getByDisplayValue("Credit Score Project");
await within(topLevelNavigation).findByDisplayValue("Credit Score Project");

expect(options.length).toBe(1);

Expand Down
6 changes: 5 additions & 1 deletion ui/src/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ const queryClient = new QueryClient();
const AllTheProviders = ({ children }: ProvidersProps) => {
return (
<QueryClientProvider client={queryClient}>
<Router initialEntries={["/"]}>
<Router
// Disable v7_relativeSplatPath: custom tab routes don't currently work with it
future={{ v7_relativeSplatPath: false, v7_startTransition: true }}
initialEntries={["/"]}
>
<QueryParamProvider adapter={ReactRouter6Adapter}>
{children}
</QueryParamProvider>
Expand Down

0 comments on commit 4c235ea

Please sign in to comment.