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
Update the attributes reducer to use a map instead of a regular object #46146
Update the attributes reducer to use a map instead of a regular object #46146
Changes from all commits
2a732c9
0bf6077
63a9295
1a3d795
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.
@youknowriad I'm inclined to add a comment documenting the choice of operations for a tangible performance hot-path optimization here. It'd be easy to lose track of it in a future refactor
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.
There are reasons why we normally don't put
Map
s or other non-serializable values in the Redux store. It's no longer showing the state in the Redux devtools for me after this PR.I wonder if there's any benchmark on this? Seems like Immer should also be performant in most cases. Were we testing it in the production build?
(Side note: adopting Immer should also help us when we want to integrate
yjs
more closely into the system for collaborative editing.)I think we should at least bring back the ability to debug values in the Redux devtools. Maybe the
serialize
option would help?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.
Is there any specific reason why Maps should be avoided, other than Redux DevTools not working with them (which to me sounds like a Redux DevTools problem)?
The link only goes on to mention:
I'm not sure which UI this refers to, nor why it would stop updating as expected.
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's a benchmark I did on my own using the same test included in this PR. A refactor using immer is actually very simple but it was three times worse in terms of performance.
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.
Good call on the "serialize" thing, I'll be fixing that in a follow-up PR.
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.
Follow-up here #46282