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:
psychedelicious
2024-02-03 20:18:13 +11:00
committed by Kent Keirsey
parent 0976ddba23
commit c1300fa8b1
24 changed files with 175 additions and 189 deletions

View File

@ -1,6 +1,6 @@
import type { PayloadAction } from '@reduxjs/toolkit';
import { createSlice } from '@reduxjs/toolkit';
import type { RootState } from 'app/store/store';
import type { PersistConfig, RootState } from 'app/store/store';
import type { ParameterHRFMethod, ParameterStrength } from 'features/parameters/types/parameterSchemas';
export interface HRFState {
@ -48,3 +48,10 @@ export const migrateHRFState = (state: any): any => {
}
return state;
};
export const hrfPersistConfig: PersistConfig<HRFState> = {
name: hrfSlice.name,
initialState: initialHRFState,
migrate: migrateHRFState,
persistDenylist: [],
};