fix: support same element used multiple times as a drop target with TouchBackend
This PR fixes an issue detailed in https://github.com/react-dnd/react-dnd/issues/3493 - the HTML5Backend and TouchBackend have an undocumented difference in how they determine which drop targets should fire their hover action during a drag.
With the HTML5Backend, if the same element is used as a drop target more than once, dragging a block over that node will trigger the hover action on every registered drop target spec for that node. With the TouchBackend, only the first drop target spec registered to that node will receive the hover event.
This PR changes the logic of the TouchBackend to collect an array of drop target IDs for a given node, rather than grabbing just the first drop target ID that is tied to the node.
I've been having trouble running the tests locally, but i've tested this code locally in my own project
I'm not sure what's going on with the failure in the Node CI build - I was actually seeing something similar locally, but that turned out to be due to my local npm/yarn setup being polluted by an installation of pnpm that I hadn't fully uninstalled.
It builds and installs fine for me now locally, although I can't get the tests to run.
Hey @darthtrevino - hope your labor day weekend was good if you're based in the US, and hope your regular weekend was good if not!
Do you have any idea what's up with the failing Node CI build for this PR? It looks like the first error is thrown around line 88 of the logs, reads as so:
react-dnd-parent@workspace:. STDERR (node:1879) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
react-dnd-parent@workspace:. STDERR (Use `node --trace-warnings ...` to show where the warning was created)
react-dnd-parent@workspace:. STDERR node:internal/errors:477
react-dnd-parent@workspace:. STDERR ErrorCaptureStackTrace(err);
react-dnd-parent@workspace:. STDERR ^
react-dnd-parent@workspace:. STDERR
react-dnd-parent@workspace:. STDERR Error [ERR_LOADER_CHAIN_INCOMPLETE]: "file:///home/runner/work/react-dnd/react-dnd/.pnp.loader.mjs 'resolve'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include `shortCircuit: true` in the hook's return.
react-dnd-parent@workspace:. STDERR at new NodeError (node:internal/errors:387:5)
react-dnd-parent@workspace:. STDERR at ESMLoader.resolve (node:internal/modules/esm/loader:852:13)
react-dnd-parent@workspace:. STDERR at async ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:7)
react-dnd-parent@workspace:. STDERR at async Promise.all (index 0)
react-dnd-parent@workspace:. STDERR at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
react-dnd-parent@workspace:. STDERR at async loadESM (node:internal/process/esm_loader:91:5)
react-dnd-parent@workspace:. STDERR at async handleMainPromise (node:internal/modules/run_main:65:12) {
react-dnd-parent@workspace:. STDERR code: 'ERR_LOADER_CHAIN_INCOMPLETE'
react-dnd-parent@workspace:. STDERR }
Hey @darthtrevino sorry for another ping, but any chance I can get you to review this? Not sure if there are other maintainers I can be bugging instead