Remove requestIdleCallback to resolve drag-and-drop UI freezing

This commit removes the use of handleLowPriorityWork with requestIdleCallback, which previously deferred state updates of draggable components to the browser's idle periods. This change ensures immediate state updates during drag-and-drop actions, providing a smoother and more responsive user experience.
This commit is contained in:
arpitnath 2024-04-10 02:13:39 +05:30
parent 50ca363f6a
commit a12ca9fed8

View file

@ -594,23 +594,21 @@ export const Container = ({
...updatedBoxes,
};
handleLowPriorityWork(() => {
const diffState = diff(boxes, newBoxes);
const diffState = diff(boxes, newBoxes);
setBoxes((prev) => {
const updatedComponentsAsperDiff = Object.keys(diffState).reduce((acc, key) => {
const component = newBoxes[key];
if (component) {
acc[key] = component;
}
return acc;
}, {});
setBoxes((prev) => {
const updatedComponentsAsperDiff = Object.keys(diffState).reduce((acc, key) => {
const component = newBoxes[key];
if (component) {
acc[key] = component;
}
return acc;
}, {});
return {
...prev,
...updatedComponentsAsperDiff,
};
});
return {
...prev,
...updatedComponentsAsperDiff,
};
});
updateCanvasHeight(newBoxes);