-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Track drag source though unmount #64
Conversation
7f4f308
to
a5c1b21
Compare
I think it's better to do this together with the resurfacing after #69. |
Mind if I leave the PR here to remind me? |
Sure |
TODO as I see it:
The upside of passing “resurfaced” component is that you can do something like The downside of doing that is sloppy behavior if there are two components with the same key on the screen at the same time. Which one would we pass? Does the most recently mounted one win? Why? Would we log a warning? Is there a legitimate use case for two components representing the same drag source? Should each of them receive Finally, what if resurfaced component has a different type? Think Should there be separate methods like |
So here's an alternative suggestion I just thought can be better than
Now let's define a compatible drag source as a component that has (or will) register a drag source with the same When something is dragged, here's what happens:
Then, until the dragging ends:
How does this API changes things? Instead of dragSource: {
getKey(component) {
return DropTypes.COLUMN + component.props.id;
}, you'd have dragSource: {
canJoinDrag(component, item) {
return item.id === component.props.id;
}, Let's do that? Note: I use mirror instead of resurfaced to clarify this may happen without source component unmounting. |
There's a good stress test case from #108: sortable example without keys. |
|
No description provided.