[EuiDataGrid] Fix cell props not clearing state on column reorder#5068
[EuiDataGrid] Fix cell props not clearing state on column reorder#5068cee-chen merged 5 commits intoelastic:masterfrom
Conversation
f824861 to
69f815a
Compare
|
@chandlerprall @thompsongl - I'm not super clear on how jest/unit tests are currently being handled for EuiDataGrid. Currently I'm not seeing any Alternatively, I can make a note/self-todo to write a Cypress test for this specifically once the current Cypress tests land - thoughts? EDIT: Unit test added, see #5068 (review) |
| componentDidUpdate(prevProps: EuiDataGridCellProps) { | ||
| if (this.props.columnId !== prevProps.columnId) { | ||
| this.setCellProps({}); | ||
| } | ||
| } |
There was a problem hiding this comment.
Let me know if you have a preferred/cleaner approach of solving this issue! I'm not in love with this or anything, although it seemed like the most straightforward solution - but I could be definitely missing something or an edge case.
There was a problem hiding this comment.
This makes sense to me. @chandlerprall can chime in if he has other thoughts, though.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5068/ |
| ]); | ||
| }); | ||
|
|
||
| it('resets cell props on column reorder', () => { |
There was a problem hiding this comment.
@chandlerprall requested a unit test for this in Slack! This is mostly a direct copy/paste of the above column order test in terms of setup (but with 1 less row and setCellProps in renderCellValue). I'm not sure if there's any DRYing out I should be doing between the 2 reorder unit tests - happy to do so if requested.
I also ran this test on master and can confirm it fails there but passes on this branch.
There was a problem hiding this comment.
I'm in favor of verbose testing 👍
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5068/ |
| ]); | ||
| }); | ||
|
|
||
| it('resets cell props on column reorder', () => { |
There was a problem hiding this comment.
I'm in favor of verbose testing 👍
| componentDidUpdate(prevProps: EuiDataGridCellProps) { | ||
| if (this.props.columnId !== prevProps.columnId) { | ||
| this.setCellProps({}); | ||
| } | ||
| } |
There was a problem hiding this comment.
This makes sense to me. @chandlerprall can chime in if he has other thoughts, though.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5068/ |
|
Going to go ahead and merge to get into the release today :) I'm happy to revert or open a follow-up PR if any changes are requested! |
This reverts commit e40ebfa.
* Upgrade EUI to v37.3.1 * Update i18n token mappings * Skip i18n_eui_mapping defString checks for functions * Update snapshots * Update failing Security tests with extra nodes * Remove hook cleanup now that elastic/eui#5068 is merged * [i18n PR feedback] Prefer specific token skipping over all functions skipping * Revert "Remove hook cleanup now that elastic/eui#5068 is merged" This reverts commit e40ebfa. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Upgrade EUI to v37.3.1 * Update i18n token mappings * Skip i18n_eui_mapping defString checks for functions * Update snapshots * Update failing Security tests with extra nodes * Remove hook cleanup now that elastic/eui#5068 is merged * [i18n PR feedback] Prefer specific token skipping over all functions skipping * Revert "Remove hook cleanup now that elastic/eui#5068 is merged" This reverts commit e40ebfa. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Upgrade EUI to v37.3.1 * Update i18n token mappings * Skip i18n_eui_mapping defString checks for functions * Update snapshots * Update failing Security tests with extra nodes * Remove hook cleanup now that elastic/eui#5068 is merged * [i18n PR feedback] Prefer specific token skipping over all functions skipping * Revert "Remove hook cleanup now that elastic/eui#5068 is merged" This reverts commit e40ebfa. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Summary
closes #4599, and I believe should also close #4665
The before/after screenshots depict the issue quite clearly, so I'll let a picture speak a thousand words for me 😄
Before
After
Checklist
- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for the any docs examples- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes