feat: hydrate

This commit is contained in:
cha0s 2022-03-20 02:22:12 -05:00
parent 322ae08eb9
commit 2e68d147b6
2 changed files with 8 additions and 1 deletions

View File

@ -50,7 +50,7 @@
"@flecks/governor": "1.4.1",
"@flecks/react": "^1.4.1",
"@flecks/redis": "1.4.1",
"@flecks/redux": "1.4.1",
"@flecks/redux": "^1.4.1",
"@flecks/repl": "1.4.1",
"@flecks/server": "1.4.1",
"@flecks/socket": "1.4.1",

View File

@ -1,6 +1,7 @@
import {
createSelector,
createSlice,
hydrateLocalStorage,
} from '@flecks/redux';
export const resourceSelector = (state) => state.resource;
@ -41,6 +42,12 @@ const slice = createSlice({
}
},
},
extraReducers: (builder) => {
builder.addCase(hydrateLocalStorage, (state, {payload}) => {
state.current = currentResourceSelector(payload);
state.open = openResourcesSelector(payload);
});
},
/* eslint-enable no-param-reassign */
});