-
Notifications
You must be signed in to change notification settings - Fork 844
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
[EuiInMemoryTable] Update state.prevProps.sortName & sortDirection #6228
[EuiInMemoryTable] Update state.prevProps.sortName & sortDirection #6228
Conversation
…tion) when they change
Preview documentation changes for this PR: https://eui.elastic.co/pr_6228/ |
if (
sortName !== prevState.prevProps.sortName ||
sortDirection !== prevState.prevProps.sortDirection
) {
updatedPrevState = {
...updatedPrevState,
sortName,
sortDirection,
};
} In the above code The issue can be reproduced by control the sort
// Consumer state
const [tableSort] = useState({
field: 'updatedAt'; // initial column we sort on
direction: 'desc';
});
|
Perfect, thanks @sebelga! I've pushed up a test for this too |
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.
LGTM! one very minor nit
Co-authored-by: Constance <[email protected]>
Preview documentation changes for this PR: https://eui.elastic.co/pr_6228/ |
@chandlerprall Will we have this fix for |
Yes, we're including this in a backport release for 8.5 |
Summary
Fixes #6032 by updating EuiInMemoryTable's
getDerivedStateFromProps
to update the sort details in prevProps as necessary.To be honest, I'm not sure how to write a meaningful test for this. @sebelga can you extract your use case to a simple test scenario? (just describing it should be fine, I can put the test together)Checklist
- [ ] Checked in both light and dark modes- [ ] Checked in mobile- [ ] Checked in Chrome, Safari, Edge, and Firefox- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for any docs examples- [ ] Checked for accessibility including keyboard-only and screenreader modes- [ ] Updated the Figma library counterpart