Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix collision detection issues (#337)
- Batch React updates in non-synthetic event handlers - Defer measurement of droppable node rects until second render after dragging - Use DragOverlay's width and height in collision rect (if it is used)
- Loading branch information
Showing
10 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@dnd-kit/core": major | ||
--- | ||
|
||
React updates in non-synthetic event handlers are now batched to reduce re-renders and prepare for React 18. | ||
|
||
Also fixed issues with collision detection: | ||
- Defer measurement of droppable node rects until second render after dragging. | ||
- Use DragOverlay's width and height in collision rect (if it is used) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export function getMeasurableNode( | ||
node: HTMLElement | undefined | null | ||
): HTMLElement | null { | ||
if (!node) { | ||
return null; | ||
} | ||
|
||
if (node.children.length > 1) { | ||
return node; | ||
} | ||
const firstChild = node.children[0]; | ||
|
||
return firstChild instanceof HTMLElement ? firstChild : node; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {getMeasurableNode} from './getMeasurableNode'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters