-
Notifications
You must be signed in to change notification settings - Fork 3
feat: useSelectable add pageOnlySelection feature #3174
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
base: main
Are you sure you want to change the base?
Conversation
✅ No New Circular DependenciesNo new circular dependencies detected. Current count: 0 |
🔍 Visual review for your branch is published 🔍Here are the links to: |
📦 Alpha Package Version PublishedUse Use |
neil-krichi
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.
thank you!! 🚀
|
Why we need to create ux inconsistencies across app? |
Depending on the nature of the data collection, the selectAll or selection can be of only the page (as for example in time tracking, where they want the selection to always be the page and not handle indeterminate cases) or of the entire collection, as in the employees table where we want to select everything and handle indeterminate cases. This is likely a UX inconsistency, but currently all cases are handled solely from a page-level perspective. As long as this remains the case, we should have the option to use a prop to gradually modify the behavior. Or at least that's what they told me from product, and from my point of view, makes sense |
In my opinion is a big inconsistency for the users, on a page the behavior is a real select all and in other a page select all, without a different UI (a different way of doing the select, a different button, etc) the users can no notice the difference causing errors and frustration Or at least that's what they told me from product, and from my point of view, makes sense Well if product is agree, I don't have anything to say |
Let me check with all the products, as it might only be necessary for the product that caused the complaint, and it's not a common issue. In addition, we should improve the design of this so the user clearly understands what's happening |
Description
Add
pageOnlySelectionfeature to theuseSelectablehook and OneDataCollection component to control selection behavior across paginated data. This enhancement allows developers to choose between two selection modes:This feature is particularly useful for bulk actions that should operate either on the current page only or across the entire dataset.
Screenshots (if applicable)
[Link to Figma Design](Figma URL here)
Implementation details
What have you changed?
Added
pageOnlySelectionproperty to:DataSourceDefinitiontype (datasource.typings.ts)UseSelectablePropstype (useSelectable/typings.ts)ExampleComponentand its propsEnhanced
useSelectablehook (useSelectable.ts):previousPageIdentifierRefuseEffecthook that clears selections when page changes (only whenpageOnlySelectionis enabled)itemsStatusandselectedIdscomputations to filter items based on current page when in page-only modetotalKnownItemsCountto reflect current page count in page-only modeAdded comprehensive documentation (
selectable-bulk-actions.mdx):Created two Storybook stories (
index.stories.tsx):WithPageOnlySelection: Demonstrates default behaviorWithCrossPageSelection: Demonstrates cross-page selection withpageOnlySelection: falseUpdated F0Select component to use the default
pageOnlySelection: falsefor backward compatibility