Skip to content

Fix useTreeData error and types #6923

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

Merged
merged 12 commits into from
Sep 5, 2024
Merged

Conversation

snowystinger
Copy link
Member

@snowystinger snowystinger commented Aug 21, 2024

Closes #1940

This would've come up for ts strict as well most likely

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Aug 21, 2024

Co-authored-by: Reid Barber <reid@reidbarber.com>
});

<ListBox
aria-label="List organisms"
items={tree.items}
selectedKeys={tree.selectedKeys}
onSelectionChange={tree.setSelectedKeys}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could solve this one in the example instead if useTreeData doesn't have and shouldn't have the same notion for 'all'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically this is also a breaking change to the types, since people would now have to account for 'all'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should punt on supporting all for now unless we are comfortable bumping a major since this is a breaking change. I actually ran into something similar for useTreeState where it doesn't support all either and we decided to punt (and potentially create a new hook?): #5756 (review)

I imagine useTreeData will need to be updated pretty heavily in the future when we get to DnD for tree like structures (I ran into a lot of issues when using it with Table sections in https://github.com/adobe/react-spectrum/pull/4444/files), should we wait till then or do you think bumping a major now would be easiest?

@rspbot
Copy link

rspbot commented Aug 21, 2024

reidbarber
reidbarber previously approved these changes Aug 21, 2024
@rspbot
Copy link

rspbot commented Aug 21, 2024

ktabors
ktabors previously approved these changes Aug 22, 2024
@rspbot
Copy link

rspbot commented Aug 22, 2024

@rspbot
Copy link

rspbot commented Aug 26, 2024

@snowystinger snowystinger dismissed stale reviews from reidbarber and ktabors via 4604bcc August 28, 2024 04:13
@rspbot
Copy link

rspbot commented Aug 28, 2024

@rspbot
Copy link

rspbot commented Aug 28, 2024

@rspbot
Copy link

rspbot commented Aug 28, 2024

@rspbot
Copy link

rspbot commented Aug 28, 2024

reidbarber
reidbarber previously approved these changes Aug 28, 2024
@rspbot
Copy link

rspbot commented Aug 29, 2024

@rspbot
Copy link

rspbot commented Sep 5, 2024

@snowystinger snowystinger merged commit 68403fe into main Sep 5, 2024
29 checks passed
@snowystinger snowystinger deleted the fix-useTreeData-docs-and-types branch September 5, 2024 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runtime error in useTreeData example.
6 participants