Skip to content

Commit abae898

Browse files
authored
memoize value for react-router provider
1 parent 928d9a6 commit abae898

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

bootstrap/src/component/Entrypoint.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ export const router = createBrowserRouter([{ path: "*", element: <Sink />, error
2424
const Entrypoint = (props) => {
2525
const entrypoint = useSelector(getEntrypoint);
2626

27+
const value = useMemo(() => ({ entrypoint, children: props.children }), [entrypoint, props.children]);
28+
2729
if (entrypoint === null) {
2830
return null;
2931
}
3032

3133
return (
32-
<Hatch.Provider value={{ entrypoint, children: props.children }}>
34+
<Hatch.Provider value={value}>
3335
<RouterProvider router={router} />
3436
</Hatch.Provider>
3537
);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lastui/rocker",
3-
"version": "0.19.20",
3+
"version": "0.19.21",
44
"license": "Apache-2.0",
55
"author": "[email protected]",
66
"homepage": "https://github.com/lastui/rocker#readme",

0 commit comments

Comments
 (0)