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

Fixes EuiInMemoryTable resetting when props update #1008

Merged

Conversation

chandlerprall
Copy link
Contributor

Fixes #1007

EuiInMemoryTable::getDerivedStateFromProps was incorrectly checking the current items against previous items to determine if it needed to reset. This caused the component to reset anytime it's parent updated the props (such as item selection getting cleared during pagination).

Copy link
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thank you for jumping on this so quickly!

<EuiInMemoryTable {...props} />
);

component.find('[data-test-subj="pagination-button-1"]').first().simulate('click');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding that - I was looking at this component yesterday and couldn't find a test that did this 👍

CHANGELOG.md Outdated
@@ -4,6 +4,10 @@
- Add typings for `EuiFlyout`, `EuiFlyoutBody`, `EuiFlyoutHeader`, and `EuiFlyoutFooter` ([#1001](https://github.com/elastic/eui/pull/1001))
- Gave `EuiFlyout` close button a data-test-subj ([#1000](https://github.com/elastic/eui/pull/1000))

**Bug fixes**

- `EuiInMemoryTable` no longer resets to the first page on prop update when `items` remains the same ([#1008](https://github.com/elastic/eui/pull/1008))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@chandlerprall chandlerprall merged commit 21cea65 into elastic:master Jul 13, 2018
@chandlerprall chandlerprall deleted the bug/1007-in-memory-table-pagination branch July 13, 2018 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants