memoize router creation using useMemo#1169
memoize router creation using useMemo#1169theAnuragMishra wants to merge 1 commit intojoinmarket-webui:develfrom
Conversation
prevents router from being recreated every time app state other than the dependencies change
|
Hey @theAnuragMishra. Thanks for the PR. |
|
ah yes sorry. i missed |
|
@theborakompanioni before i try to work on the issue in v2, i'd like to confirm what appraoch would be preferable. like i described, we could make a simple fix by memoizing, or follow what you may call the idiomatic way, that is, create a stable router once outside App and the route elements read state themselves instead of passing a lot of props into the route elements. |
Yeah, if that is possible, let's do it. |
|
#1175 . some more work needs to be done though. but let's move the discussion there and close this pr. |
This PR memoizes router creation using
useMemo. prevents router from being recreated every time app state other than the dependencies change.while this works, i think there are other better options, maybe. like moving to react 19 which does memoization automatically (not really sure if the compiler would memoize cases like these). or just removing conditional routing and adding state guards in the components for the routes.
fixes #1155