🐛 Fix issue with edit mode resizing

This commit is contained in:
Meierschlumpf
2023-01-17 21:35:17 +01:00
parent 8b3aa72f1c
commit 8c5e002aac
3 changed files with 9 additions and 4 deletions

View File

@@ -232,6 +232,11 @@ export const useGridstack = (
// initialize the gridstack
useEffect(() => {
const removeEventHandlers = () => {
gridRef.current?.off('change');
gridRef.current?.off('added');
};
const tilesWithUnknownLocation: TileWithUnknownLocation[] = [];
initializeGridstack(
areaType,
@@ -250,7 +255,7 @@ export const useGridstack = (
onAdd,
}
);
if (!configName) return;
if (!configName) return removeEventHandlers;
updateConfig(configName, (prev) => ({
...prev,
apps: prev.apps.map((app) => {
@@ -300,6 +305,7 @@ export const useGridstack = (
};
}),
}));
return removeEventHandlers;
}, [items, wrapperRef.current, widgets, wrapperColumnCount]);
return {