-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add support for nested filtering in useListData #6124
Open
gijsroge
wants to merge
7
commits into
adobe:main
Choose a base branch
from
gijsroge:main
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+87
−5
Open
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c5cd1c2
Add support for nested filtering in useListData
gijsroge ae53adf
Merge branch 'main' into main
snowystinger e14ddc5
Update test to show multiple valid sections
snowystinger 56a1037
Merge branch 'adobe:main' into main
gijsroge 444c1f3
Use configurable filterKey to filter nested sections
gijsroge fdc0b0e
Merge branch 'adobe:main' into main
gijsroge 5acde87
Merge branch 'main' into main
snowystinger File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is assuming something about the data structure of an item that isn't specified in the types. What if section objects use a different property name for their children or they come from a different data source entirely? I don't think useListData should be prescriptive about the objects that get passed into it.
If your items have children maybe useTreeData would be more appropriate?
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.
Yeah I see what you mean. The reason for this PR was mostly to expand support for Listbox filtering (nested items), AFAIK listbox does not support useTreeData and useTreeData does not support filtering out of the box?
What would be your ideal scenario to add support for this? Maybe a more generic way of filtering that does not depend on a specific property?
Maybe something like this?
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.
So listbox does actually support being passed items from useTreeData, but you are right about useTreeData not supporting filtering out of the box. I've raised a question to the team about whether we'd prefer to commit to having nested item filter support supported useListData (which would then mean we'd need to update the rest of the useListData methods to work for nested data) or if we'd instead add filtering to useTreeData.
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.
Thanks for your patience. We had an internal discussion and decided we'd like to add filtering to useTreeData instead of having useListData be another tree implementation.
Would you like to have a go at that in this PR?
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.
@snowystinger understood, feels better to do it in useTreeData indeed. I will take a stab at it. Do I start a new PR for this?
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.
either one, whatever you're more comfortable with. If you use this one, we'll just rename it