🐛 Fix deprecated zustand dependencies

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

No files matched your search

@@ -1,4 +1,4 @@
import { create } from 'zustand';
import { createWithEqualityFn } from 'zustand/traditional';
import { ServerSidePackageAttributesType } from '../../server/getPackageVersion';
@@ -7,9 +7,12 @@ interface PackageAttributesState {
setInitialPackageAttributes: (attributes: ServerSidePackageAttributesType) => void;
}
export const usePackageAttributesStore = create<PackageAttributesState>((set) => ({
attributes: { packageVersion: undefined, environment: 'test', dependencies: {} },
setInitialPackageAttributes(attributes) {
set((state) => ({ ...state, attributes }));
},
}));
export const usePackageAttributesStore = createWithEqualityFn<PackageAttributesState>(
(set) => ({
attributes: { packageVersion: undefined, environment: 'test', dependencies: {} },
setInitialPackageAttributes(attributes) {
set((state) => ({ ...state, attributes }));
},
}),
Object.is
);