-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compare versions drawer, fix route meta
- route meta previously was only derived from the deepest matched route, even if that route did not define a route handle but an ancestor did - it will now use the most deeply nested matched route's metadata
- Loading branch information
1 parent
b483e3f
commit d3ae725
Showing
19 changed files
with
715 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useAtomValue } from "jotai"; | ||
import { useEffect } from "react"; | ||
|
||
import { routerAtom } from "~features/routing/state"; | ||
|
||
/** | ||
* Calls the provided callback when the route changes | ||
*/ | ||
export function useRouteChange(callback: () => void) { | ||
const router = useAtomValue(routerAtom); | ||
|
||
useEffect(() => { | ||
return router?.subscribe(() => callback()); | ||
}, [router, callback]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { atom } from "jotai"; | ||
import { RouteObject } from "react-router-dom"; | ||
import { createBrowserRouter, RouteObject } from "react-router-dom"; | ||
|
||
export const routesAtom = atom<RouteObject[]>([]); | ||
export const routerAtom = atom<ReturnType<typeof createBrowserRouter> | null>( | ||
null, | ||
); |
Oops, something went wrong.