Skip to content

Commit 2352a00

Browse files
wraps removeClass invocation in handleend in raf
1 parent 784bbdf commit 2352a00

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/index.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,36 +1889,36 @@ export function handleEnd<T>(state: DragState<T> | SynthDragState<T>) {
18891889
? config?.synthDropZoneClass
18901890
: config?.dropZoneClass;
18911891

1892+
console.log("handleEnd", dropZoneClass);
1893+
18921894
requestAnimationFrame(() => {
18931895
if (state.originalZIndex !== undefined) {
18941896
state.draggedNode.el.style.zIndex = state.originalZIndex;
18951897
}
1896-
});
1897-
1898-
// Force a style recalculation to ensure we're in the next browser paint cycle
1899-
// First remove drop zone class
1900-
removeClass(
1901-
state.draggedNodes.map((x) => x.el),
1902-
dropZoneClass
1903-
);
19041898

1905-
// Force another style recalculation for the next set of changes
1899+
// Force a style recalculation to ensure we're in the next browser paint cycle
1900+
// First remove drop zone class
1901+
removeClass(
1902+
state.draggedNodes.map((x) => x.el),
1903+
dropZoneClass
1904+
);
19061905

1907-
// Remove other classes in a separate animation frame
1908-
removeClass(
1909-
state.draggedNodes.map((x) => x.el),
1910-
state.initialParent.data?.config?.longPressClass
1911-
);
1906+
// Remove other classes in a separate animation frame
1907+
removeClass(
1908+
state.draggedNodes.map((x) => x.el),
1909+
state.initialParent.data?.config?.longPressClass
1910+
);
19121911

1913-
removeClass(
1914-
state.draggedNodes.map((x) => x.el),
1915-
isSynth
1916-
? state.initialParent.data.config.synthDragPlaceholderClass
1917-
: state.initialParent.data?.config?.dragPlaceholderClass
1918-
);
1912+
removeClass(
1913+
state.draggedNodes.map((x) => x.el),
1914+
isSynth
1915+
? state.initialParent.data.config.synthDragPlaceholderClass
1916+
: state.initialParent.data?.config?.dragPlaceholderClass
1917+
);
19191918

1920-
deselect(state.draggedNodes, state.currentParent, state);
1921-
setActive(state.currentParent, undefined, state);
1919+
deselect(state.draggedNodes, state.currentParent, state);
1920+
setActive(state.currentParent, undefined, state);
1921+
});
19221922

19231923
resetState();
19241924
state.selectedState = undefined;

0 commit comments

Comments
 (0)