mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
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:
parent
50ca363f6a
commit
a12ca9fed8
1 changed files with 13 additions and 15 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue