next-redux-wrapper usage slows down route change
See original GitHub issueDescribe the bug
Whenever I use next-redux-wrapper, changing routes starts to get really slow.
export const getServerSideProps: GetServerSideProps<I18nProps<MyLocale>> = getStore((store) => async (ctx) => {
// ...
store.dispatch(setFeatureFlags(flags));
// ...
store.dispatch(updateDevice(getSelectorsByUserAgent(ctx.req.headers["user-agent"])));
return ...;
});
With the code above, whenever I change routes, it takes around 10s to change on dev and 5s on prod. If I remove it, it becomes instant, like milliseconds.
To Reproduce
The code is proprietary, I can’t fork or clone it.
Steps to reproduce the behavior:
Just use this library with some dependencies like usedapp, or theming, or any UI lib. Check how long it takes to change routes. Remove it, and you’ll see the difference.
Expected behavior
Using redux shouldn’t impact the app routing load time.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 6]
Additional context
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:15 (2 by maintainers)
Top Results From Across the Web
nextjs get slow on route change in react 18 and redux(legacy ...
the issue is: when we use react 18.0.0 to 18.2.0 the app takes around 7 sec on production to change the route. on...
Read more >next-redux-wrapper - npm
Redux wrapper for Next.js. Latest version: 8.0.0, last published: 4 months ago. Start using next-redux-wrapper in your project by running ...
Read more >Redux Essentials, Part 6: Performance and Normalizing Data
How to create memoized selector functions with createSelector; Patterns for optimizing component rendering performance; How to use ...
Read more >What's new in Next.js 13, and what do they really do?
You use folders to define routes, and special files with reserved names ... Your mental model of how components work in Next.js has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can release it, it’s been in beta for quite some time.
hi , i had this problem too, you can use 8.0.0-rc.1 instead of 7.0.5 there is some changes
for create store you must use configureStore
and in _app.js: