Skip to content
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 moveBefore and and moveAfter methods to useTreeData #5574

Open
jamesopstad opened this issue Dec 14, 2023 · 2 comments · Fixed by #7689 · May be fixed by #7854
Open

Add moveBefore and and moveAfter methods to useTreeData #5574

jamesopstad opened this issue Dec 14, 2023 · 2 comments · Fixed by #7689 · May be fixed by #7854
Labels
enhancement New feature or request

Comments

@jamesopstad
Copy link

Provide a general summary of the feature here

useListData has the moveBefore and moveAfter methods, which are useful for working with drag and drop. It would be useful to have equivalents for useTreeData. This was mentioned in this PR #4444 but it was closed.

🤔 Expected Behavior?

This should work just like the moveBefore and moveAfter methods for useListData. The types would be the same:

moveBefore(key: Key, keys: Iterable<Key>): void
moveAfter(key: Key, keys: Iterable<Key>): void

😯 Current Behavior

These methods currently don't exist.

💁 Possible Solution

No response

🔦 Context

It is currently difficult to reorder items in tree structures, particularly when working with drag and drop. This feature would make this much easier.

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@reidbarber reidbarber added the enhancement New feature or request label Dec 14, 2023
@LFDanLu
Copy link
Member

LFDanLu commented Dec 15, 2023

Just a fyi, I've added this issue to our internal tracking ticket: RSP Component Milestones (view). Thanks for raising this, we'll definitely need it for our eventual implementation of Tree.

@LFDanLu
Copy link
Member

LFDanLu commented Feb 28, 2025

Just a heads up but we've reverted #7689 for now since we'd like the api to mirror useListData more closely after a team discussion, reopening this until that is implemented. Theoretically, you should be able to accomplish moveBefore/After with just the existing move call that exists

@snowystinger snowystinger linked a pull request Mar 3, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants