Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[docs] Remove old workarounds #20587
[docs] Remove old workarounds #20587
Changes from 4 commits
ab9302f
a7030e5
e262548
b438d6f
b83ebae
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Webpack is clever enough to remove
redux-logger
from prod bundles (at least the bundle size didn't show that so it's either bundled anyway or working as expected). One less global require :)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.
Note for context.
The incentive for the global was to account for cases where Next.js doesn't bundle redux into the share JavaScript bundle. In the past, I had multiple cases where we would get a new instance of redux per page. I don't know if it's still a concern today.
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.
How would we get multiple instances? There's only a single store.
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.
Basically, Next.js/webpack would fail to identify Redux as a module that needs to be put into the shared bundle. In some cases, we had:
docs/src/modules/redux/initRedux.js
docs/src/modules/redux/initRedux.js
(duplicate)the JavaScript reference doesn't match, we end-up with two Redux store loading when transitioning from page a to page b, page b has no prior knowledge of the store of page a.
I imagine it can be reproduced in dev mode, where we only build one page at the time.
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.
Even if this were the case: What is the problem? These are pure functions (ignoring devtools). We can call them how often we want.
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.
And again: Every page could have its own module. We would still use the same store across pages since AppWrapper stays mounted.
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 was causing an issue with the states that aren't persisted. For instance, if we store the dark theme into redux or the color of the page, we would lose it with the first page transition.
As long as we don't notice a behavior in this order, I think it's safe to move forward.
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.
To illustrate: You're seeing the flamegraph of the commit after we navigated from / to /components/box. "ne" is the AppWrapper component that got updated. It didn't "render for the first time" i.e. mount. What mounted was the page (the big yellow bar):
The store wasn't re-created. That only happens when AppWrapper mounts which happens once.
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.
👌