Skip to content
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

impact on performance when store rerenders on every request. #552

Open
wibed opened this issue Jul 6, 2023 · 1 comment
Open

impact on performance when store rerenders on every request. #552

wibed opened this issue Jul 6, 2023 · 1 comment
Labels

Comments

@wibed
Copy link

wibed commented Jul 6, 2023

based on:
https://stackoverflow.com/questions/74888537/proper-way-of-using-redux-and-rtkq-in-nextjs-with-code-splitting

i assume the wrapper reloads the whole configuration on any request the store does some form of mutation.

I'd like to know whether anyone has tried and succeeded in implementing redux code splitting using RTK, RTKQ and NextJs. Also, I would like to ask an addition question: Is it necessary? What I mean by this is, if I were to not code-split at all, and send all slices on every request, how performance impactful would this be? Also, since I'm not sure exactly how the NextJs bundler works and how code chunking is done: If a certain page receives a slice it doesn't use at all, will it only receive its initial state or all of its logic (all the selectors, reducers and actions)? If not then maybe this isn't so bad, since initial states are just empty objects.

@wibed wibed added the bug label Jul 6, 2023
@sebastiangrebe
Copy link

A guess in the blind but generally as you use combineReducers for when setting up the store all of the initial state and the code you are importing via that is part of the page load
So I would assume that those initial state objects are there but should ideally be more or less empty and filled from SSR based on the context of this page so ideally not affect other pages too much

The code that you import in your reducers though will be not split from what I see in my projects with redux toolkit as it is necessary to create the full store once

But just what I notice with my projects
Ideally the state and code inside reducers should be minimal compared to actual application logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants