From 90684b6b42be7bca496db4515109da07ae841e7a Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Fri, 30 Jul 2021 10:43:40 +0100 Subject: [PATCH] test fix for redux state update --- pages/myportal/index.js | 15 +++++++++++---- store/store.js | 7 ++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pages/myportal/index.js b/pages/myportal/index.js index 192bf766..5fcb0d75 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -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)); diff --git a/store/store.js b/store/store.js index 634c5334..e59d8bdb 100644 --- a/store/store.js +++ b/store/store.js @@ -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 };