-
Notifications
You must be signed in to change notification settings - Fork 2.2k
add react-router and split on activity paths #4767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Awesome work that would benefit us moving forward! I just left a few questions that I would love to learn more about this work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I will try to contribute adding unit tests to it. I suppose props in each Wrapper-components can also move else where in the future when we are ready!
jackkav
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation about default exports, and future work would be great but besides that looks like a positive low risk first step.
| const ActivityRouter = () => { | ||
| const activity = useSelector(selectActiveActivity); | ||
| const navigate = useNavigate(); | ||
|
|
||
| React.useEffect(() => { | ||
| if (activity) { | ||
| navigate(activity); | ||
| } | ||
| }, [activity, navigate]); | ||
|
|
||
| return null; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to list or link to the future work to untangle this workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added next steps on the pr details!
filfreire
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this locally. LGTM!
Difference is almost not noticeable when doing bootstrap and then app-start, BUT, we do seem to shave off at least 3 to 4 seconds on the packaged app itself from the moment the window opens until the moment we "draw" something. Definitely looks faster.
Really nice work @gatzjames 👍
Adds react-router and uses the
activityas initial paths to render routes and code-split.Some learnings:
<Link to="..."/>components andconst navigate = useNavigate()hook usage. We might need to untangle some state management that has to do with navigation from redux also e.g. tracking events and other reducers that "listen" on the activity changing.React.lazy() reactjs/rfcs#64 (comment) seems to be that react will use the module information for optimisations in next versions. The same is true for bundlers (e.g. vite) that use the module info to preload other modules ahead of time and code splitting.
changelog(Improvements): Improved Insomnia's startup time