Fix #3030: Selection for DataTable cleared with custom action settings#3669
Fix #3030: Selection for DataTable cleared with custom action settings#3669Francisc0C wants to merge 3 commits intoplotly:devfrom
Conversation
|
Thanks for the PR! Our team will take a look and follow up. At first glance, I see the Dash Table tests are failing. Could you take a look and see if there are any updates that need to be made? |
8b2d9e8 to
3818ec1
Compare
|
Hi! The only Dash Table test that was failing is the same one that was already failing in the project version from a few weeks ago when I created the PR (commit ffff73d). I’ve now rebased onto the current Apologies for the multiple force pushes, I accidentally rebased my commit onto |
AnnMarieW
left a comment
There was a problem hiding this comment.
Could you rebase your branch onto the latest dev and push again?
Right now, when I build your PR as-is, I see the same errors that shows up in GitHub CI. However, if I apply your changes on top of the current dev branch locally, the build works and all the DataTable tests pass.
components/dash-table/tests/selenium/test_selected_rows_custom.py
Outdated
Show resolved
Hide resolved
…ettings In derivedPropsHelper.ts, selected rows may be invalidated when sorting, filtering or changing pages, while using custom action settings. Invalidation happens when sorting, filtering or pagination actions are set to custom and their values change. The code does not check wether the same callback also provides a new selected_rows value. Because invalidation runs inside a setTimeout(..., 0), when a callback updates both selection and sorting, filtering or pagination, the selection briefly appears and clears, causing a visible "flicker". To fix this, before invalidating the selection, we simply have to check wether selected_rows actually changed in the current callback. The selection is only cleared if it did not change, preventing the invalidation of the sent selection.
|
Thanks @Francisc0C It looks like that worked! @T4rk1n this is now ready for a review. Also needs a changelog entry. |
Co-authored-by: Ann Marie Ward <72614349+AnnMarieW@users.noreply.github.com>
This PR fixes issue #3030 and two analogous bugs in derivedPropsHelper.ts.
In derivedPropsHelper.ts, selected rows may be invalidated when sorting, filtering or changing pages, while using custom action settings.
Invalidation happens when sorting, filtering or pagination actions are set to custom and their values change.
The code does not check whether the same callback also provides a new selected_rows value.
Because invalidation runs inside a setTimeout(..., 0), when a callback updates both selection and sorting, filtering or pagination, the selection briefly appears and clears, causing a visible "flicker".
The fix adds a check before invalidating the selection. We verify whether selected_rows actually changed in the current callback, if it did not change, the selection is preserved preventing incorrect invalidation.
Contributor Checklist
derivedPropsHelper.tsto verify ifselected_rowschanged before invalidating the selectionoptionals
CHANGELOG.md