mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
refactor(ui): refactor persist config
Add more structure around persist configs to avoid bugs from typos and misplaced persist denylists.
This commit is contained in:
committed by
Kent Keirsey
parent
0976ddba23
commit
c1300fa8b1
@ -1,3 +0,0 @@
|
||||
import type { SystemState } from './types';
|
||||
|
||||
export const systemPersistDenylist: (keyof SystemState)[] = ['isConnected', 'denoiseProgress', 'status'];
|
@ -1,7 +1,7 @@
|
||||
import type { UseToastOptions } from '@invoke-ai/ui-library';
|
||||
import type { PayloadAction } from '@reduxjs/toolkit';
|
||||
import { createSlice, isAnyOf } from '@reduxjs/toolkit';
|
||||
import type { RootState } from 'app/store/store';
|
||||
import type { PersistConfig, RootState } from 'app/store/store';
|
||||
import { calculateStepPercentage } from 'features/system/util/calculateStepPercentage';
|
||||
import { makeToast } from 'features/system/util/makeToast';
|
||||
import { t } from 'i18next';
|
||||
@ -207,3 +207,10 @@ export const migrateSystemState = (state: any): any => {
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
export const systemPersistConfig: PersistConfig<SystemState> = {
|
||||
name: systemSlice.name,
|
||||
initialState: initialSystemState,
|
||||
migrate: migrateSystemState,
|
||||
persistDenylist: ['isConnected', 'denoiseProgress', 'status'],
|
||||
};
|
||||
|
Reference in New Issue
Block a user