switch to a stable router + route guards#1175
switch to a stable router + route guards#1175theAnuragMishra wants to merge 1 commit intojoinmarket-webui:v2from
Conversation
|
@theborakompanioni sorry for the delay. do you like the direction this is going in? the idea basically is to create route components unconditionally and use state variables in these components to redirect or keep on the page. this makes the router independent of state. the work is not fully complete yet. i'd like to get some review before i finalize. |
|
Hey @theAnuragMishra! Edit: Do you know the benefits of route-modules over component-routes? |
|
@theborakompanioni are you planning to switch to route modules? as i can see jam already uses the latest react-rotuer so migration will not be very hard. if you want i can go in that direction as well. |
💪
Yeah, sounds reasonable. But if you want, you can do that in a follow-up PR. First, let's bring your idea in a state that can be reviewed and tested. Sounds okay? |
67562af to
dba9f7f
Compare
|
@theborakompanioni i think the pr is ready for review. i have run the tests and manually tested the ui. To summarize the changes: function ComponentThatHandlesConditionalRendering(){
return someCondition ? <Element1/> : <Element2/>
}
<Route path="/xyz" element={<ComponentThatHandlesConditionalRendering/>}/>Now the router itself doesn't depend on any state and renders a fixed component. This component manages what to do depending on the state. The router is stable 😀 From my side I have tried to follow all the contribution guideliens. Only minimally used AI for some suggestiosn, most of the work is my own. If anything needs any further change, please tell :) |
|
CI runs clean on my fork. also since we are already using tanstack-query, we should probably stick to Component routes. |
|
Hey @theAnuragMishra .. |
|
@theborakompanioni i did visually test it but not the entire flow. sorry i gave the context to protected routes without navbar but missed those with navbar. |
00160e7 to
efa6d79
Compare
basically , we take out the state logic from route creation into the components.