Skip to content

Fixes EuiInMemoryTable resetting when props update#1008

Merged
chandlerprall merged 5 commits into
elastic:masterfrom
chandlerprall:bug/1007-in-memory-table-pagination
Jul 13, 2018
Merged

Fixes EuiInMemoryTable resetting when props update#1008
chandlerprall merged 5 commits into
elastic:masterfrom
chandlerprall:bug/1007-in-memory-table-pagination

Conversation

@chandlerprall
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 👍

Comment thread CHANGELOG.md

**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
Copy Markdown
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