🐛 Issue with moving items arround with change-position-modal

This commit is contained in:
Meier Lukas
2023-10-08 21:00:10 +02:00
parent 4ad87fcf89
commit f8dfc3b23b
12 changed files with 334 additions and 400 deletions

View File

@@ -11,8 +11,6 @@ const GridstackContext = createContext<GridstackContextProps>({
export const useGridstackRef = () => {
const ctx = useContext(GridstackContext);
if (!ctx || !ctx.ref)
throw new Error('useGridstackContext must be used within a GridstackProvider');
return ctx.ref;
};

View File

@@ -13,12 +13,10 @@ export const useResizeGridItem = () => {
const gridstackRef = useGridstackRef();
return ({ height, width, ...options }: ResizeGridItemProps) => {
gridstackRef.current?.batchUpdate();
gridstackRef.current?.update(itemRef.current!, {
gridstackRef?.current?.update(itemRef.current!, {
...options,
h: height,
w: width,
});
gridstackRef.current?.batchUpdate(false);
};
};