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

added node as return value in useDragHook #210

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mafin1799
Copy link

in the useDragHook hook, is it possible to somehow return not the id but the entire node?
solution to issues #209

@jameskerr
Copy link
Member

The reason I just have the id being returned is because this little bit of advice given here:

https://react-dnd.github.io/react-dnd/docs/api/use-drag#specification-object-members

I'm not sure what the implications are by returning the node instead of the id.

Can you explain what you need to know about the node when you're dragging between trees?

@mafin1799
Copy link
Author

dragging between trees in my implementation is checked on the server

to do this, I pass the id and alias of the tree

like

currentTree: device
targetTree: user
objectId: [678, 789, 456]
dropId: [555]

Something like that

Ideally, I need to understand which tree I'm dragging from.

the dragging itself happens to me so that when I hover the dragged element over the node, a request is sent to the server

he checks whether it is possible to drop into this node
, if so, and drop it, then an answer comes that updates the slice of this tree

@jameskerr
Copy link
Member

So you need to know the id of the tree and the id of the node? Is that all the data you need?

@jameskerr jameskerr added the documentation Improvements or additions to documentation label Feb 7, 2024
@mafin1799
Copy link
Author

Yes, it may be worth entering the treeName parameter in the initialization of the Tree component. Because it can be expensive to drive all year and I can see how to implement it and propose a new solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants