-
Notifications
You must be signed in to change notification settings - Fork 4k
[Fix] st.dataframe: clear row selections on dropdown sort
#11363
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
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
✅ PR preview is ready!
|
| // Keeping row selections when sorting columns is not supported at the moment. | ||
| // So we need to clear the selected rows before we do the sorting (Issue #11345). | ||
| // Maintain column selections as these are not impacted. | ||
| clearSelection(false, true) |
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.
Think it makes sense here to only clear row selections while maintaining column selections, but lmk if alternative thoughts
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.
Pull Request Overview
This PR fixes an issue in st.dataframe where row selections persist after sorting via dropdown, ensuring that only column selections remain. Key changes include:
- Updating DataFrame.tsx to clear row selections on dropdown sort.
- Renaming and reordering test helper functions in the Playwright tests.
- Adding new E2E tests to verify the updated selection behavior.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/lib/src/components/widgets/DataFrame/DataFrame.tsx | Implements conditional clearing of row selections before sorting |
| e2e_playwright/st_dataframe_selections_test.py | Renames helper functions and adds tests for single-row selection behavior on sort |
| e2e_playwright/st_dataframe_selections.py | Adds a new section for testing single-row & single-column selection |
Comments suppressed due to low confidence (2)
e2e_playwright/st_dataframe_selections_test.py:56
- The renaming of the test helper function should be double-checked to ensure it accurately reflects its purpose and corresponds to the correct DataFrame index in the UI.
def _get_single_row_and_column_select_df(app: Page) -> Locator:
e2e_playwright/st_dataframe_selections_test.py:57
- Verify that the updated nth index in the helper function aligns with the intended DataFrame instance for this test scenario to avoid misreferencing.
return app.get_by_test_id("stDataFrame").nth(5)
lukasmasuch
left a comment
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 👍
Describe your changes
st.dataframe: on sort (via dropdown) clear the selected row(s) consistent with the column header sort behavior.Currently, when the data in the table is reordered via sorting, the selected row (ex: row 1) persists - so even though the previously selected data is not in row 1 anymore, row 1 still shows as selected.
GitHub Issue Link (if applicable)
Closes #11345
Testing Plan