🐛 Fix deprecated zustand dependencies

This commit is contained in:
Meier Lukas
2023-08-09 21:41:57 +02:00
parent d9eec612d8
commit db8d88affc
5 changed files with 94 additions and 130 deletions

View File

@@ -1,14 +1,17 @@
import { create } from 'zustand';
import { createWithEqualityFn } from 'zustand/traditional';
import { useConfigContext } from '../../../../config/provider';
import { GridstackBreakpoints } from '../../../../constants/gridstack-breakpoints';
export const useGridstackStore = create<GridstackStoreType>((set, get) => ({
mainAreaWidth: null,
currentShapeSize: null,
setMainAreaWidth: (w: number) =>
set((v) => ({ ...v, mainAreaWidth: w, currentShapeSize: getCurrentShapeSize(w) })),
}));
export const useGridstackStore = createWithEqualityFn<GridstackStoreType>(
(set, get) => ({
mainAreaWidth: null,
currentShapeSize: null,
setMainAreaWidth: (w: number) =>
set((v) => ({ ...v, mainAreaWidth: w, currentShapeSize: getCurrentShapeSize(w) })),
}),
Object.is
);
interface GridstackStoreType {
mainAreaWidth: null | number;