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
[TreeView] Do not use outdated version of the state to compute new label first char in RichTreeView
#12512
[TreeView] Do not use outdated version of the state to compute new label first char in RichTreeView
#12512
Conversation
…abel first char in RichTreeView
RichTreeView
Deploy preview: https://deploy-preview-12512--material-ui-x.netlify.app/ |
); | ||
if (itemElement) { | ||
itemElement.blur(); | ||
if (node) { |
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.
Not directly related but I noticed this bug while writing the tests.
If we remove the currently focused item from props.items
, then its TreeItem
while call removeFocusedItem
, but the state does not contain the item anymore so it crashes.
RichTreeView
RichTreeView
}; | ||
|
||
params.items.forEach(processItem); | ||
Object.values(state.nodes.nodeMap).forEach(processItem); |
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.
Btw this will support stuff like apiRef.current.updateItem
when we add this kind of API, the previous approach did not.
It's still far from perfect because we loop through the whole dataset, but until we actually have partial dataset update it's good enough.
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.
Looks good to me! 🎉
Left a tiny comment about naming 😬
Fixes #12510