test fix for redux state update

This commit is contained in:
2021-07-30 10:43:40 +01:00
parent a084b569c9
commit 90684b6b42
2 changed files with 17 additions and 5 deletions
+11 -4
View File
@@ -70,10 +70,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
async ({ query, req, res }) => {
//console.log("the query", query);
const myCases = await getMyCases();
const myRepresentations = await getMyRepresentations();
const watchedCases = await getWatchedCases();
const awaitingSubmission = await getAwaitingSubmission();
const [
myCases,
myRepresentations,
watchedCases,
awaitingSubmission,
] = await Promise.all([
await getMyCases(),
await getMyRepresentations(),
await getWatchedCases(),
await getAwaitingSubmission(),
]);
store.dispatch(setMyCases(myCases));
store.dispatch(setMyRepresentations(myRepresentations));
+6 -1
View File
@@ -95,7 +95,11 @@ const makeStore = ({ isServer }) => {
return createStore(reducer, bindMiddleware([thunkMiddleware]));
} else {
//If it's on client side, create a store which will persist
const { persistStore, persistReducer } = require("redux-persist");
const {
persistStore,
persistReducer,
createMigrate,
} = require("redux-persist");
const storage = require("redux-persist/lib/storage").default;
const persistConfig = {
@@ -114,6 +118,7 @@ const makeStore = ({ isServer }) => {
"watchedCases",
"form",
],
version: 1,
storage: storage,
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
};