diff --git a/src/store/loadingState.ts b/src/store/loadingState.ts index b686cfe2..3c42c962 100644 --- a/src/store/loadingState.ts +++ b/src/store/loadingState.ts @@ -10,8 +10,8 @@ const STORE_NAME = 'LoadingState'; export const useLoadingStateStore = create()( devtools( (...args) => ({ - ...createBaseSlice({ basic: 'isLoading' }, false, STORE_NAME)(...args), + ...createBaseSlice({ basic: 'isLoading' }, false)(...args), }), - { enabled: !IS_PROD_MODE }, + { name: 'Linked Data Editor', store: STORE_NAME, enabled: !IS_PROD_MODE }, ), ); diff --git a/src/store/marcPreview.ts b/src/store/marcPreview.ts index 66950cbc..29065873 100644 --- a/src/store/marcPreview.ts +++ b/src/store/marcPreview.ts @@ -15,10 +15,10 @@ const STORE_NAME = 'MarcPreview'; export const useMarcPreviewStore = create()( devtools( (...args) => ({ - ...createBaseSlice({ basic: 'basicValue' }, null, STORE_NAME)(...args), - ...createBaseSlice({ basic: 'complexValue' }, null as MarcPreviewData, STORE_NAME)(...args), - ...createBaseSlice({ basic: 'metaData' }, null as MarcPreviewMetaData, STORE_NAME)(...args), + ...createBaseSlice({ basic: 'basicValue' }, null)(...args), + ...createBaseSlice({ basic: 'complexValue' }, null as MarcPreviewData)(...args), + ...createBaseSlice({ basic: 'metaData' }, null as MarcPreviewMetaData)(...args), }), - { enabled: !IS_PROD_MODE }, + { name: 'Linked Data Editor', store: STORE_NAME, enabled: !IS_PROD_MODE }, ), ); diff --git a/src/store/status.ts b/src/store/status.ts index 99ad4088..00219aa3 100644 --- a/src/store/status.ts +++ b/src/store/status.ts @@ -15,16 +15,15 @@ const STORE_NAME = 'Status'; export const useStatusStore = create()( devtools( (...args) => ({ - ...createBaseSlice({ basic: 'lastSavedRecordId' }, null as LastSavedRecordId, STORE_NAME)(...args), - ...createBaseSlice({ basic: 'isEditedRecord' }, false, STORE_NAME)(...args), - ...createBaseSlice({ basic: 'recordStatus' }, { type: undefined } as RecordStatus, STORE_NAME)(...args), + ...createBaseSlice({ basic: 'lastSavedRecordId' }, null as LastSavedRecordId)(...args), + ...createBaseSlice({ basic: 'isEditedRecord' }, false)(...args), + ...createBaseSlice({ basic: 'recordStatus' }, { type: undefined } as RecordStatus)(...args), ...createBaseSlice<'statusMessages', StatusEntry[], 'statusMessage', StatusEntry>( { basic: 'statusMessages', singleItem: 'statusMessage' }, [] as StatusEntry[], - STORE_NAME, true, )(...args), }), - { enabled: !IS_PROD_MODE }, + { name: 'Linked Data Editor', store: STORE_NAME, enabled: !IS_PROD_MODE }, ), ); diff --git a/src/store/utils/slice.ts b/src/store/utils/slice.ts index f79c26b6..f3174e8d 100644 --- a/src/store/utils/slice.ts +++ b/src/store/utils/slice.ts @@ -47,7 +47,6 @@ const updateValue = (value: V, updatedValue: T): V => { export const createBaseSlice = ( keys: { basic: K; singleItem?: S }, initialValue: V, - sliceTitle: string, canAddSingleItem = false, ): StateCreator, [['zustand/devtools', never]], [], SliceState> => { return set => { @@ -56,9 +55,8 @@ export const createBaseSlice = - set({ [keys.basic]: updatedValue } as any, false, `${sliceTitle}/set${capitalizedTitle}`), - [`reset${capitalizedTitle}`]: () => - set({ [keys.basic]: initialValue } as any, false, `${sliceTitle}/reset${capitalizedTitle}`), + set({ [keys.basic]: updatedValue } as any, false, `set${capitalizedTitle}`), + [`reset${capitalizedTitle}`]: () => set({ [keys.basic]: initialValue } as any, false, `reset${capitalizedTitle}`), } as SliceState; if (canAddSingleItem && keys.singleItem) { @@ -70,7 +68,7 @@ export const createBaseSlice =