File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
1616 use ,
1717 useCallback ,
1818 useEffect ,
19+ useId ,
1920 useMemo ,
2021 useRef ,
2122 useState ,
@@ -300,6 +301,9 @@ export function ChessboardProvider({
300301 // the animation timeout whilst waiting for animation to complete
301302 const animationTimeoutRef = useRef < NodeJS . Timeout | null > ( null ) ;
302303
304+ // unique id for dnd context, we need this to prevent hydration issues
305+ const dndId = useId ( ) ;
306+
303307 // if the position changes, we need to recreate the pieces array
304308 useEffect ( ( ) => {
305309 const newPosition =
@@ -667,6 +671,7 @@ export function ChessboardProvider({
667671 onDragEnd = { handleDragEnd }
668672 onDragCancel = { handleDragCancel }
669673 sensors = { sensors }
674+ id = { dndId }
670675 >
671676 { children }
672677 </ DndContext >
You can’t perform that action at this time.
0 commit comments