test fix for redux state update
This commit is contained in:
+11
-4
@@ -70,10 +70,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
async ({ query, req, res }) => {
|
async ({ query, req, res }) => {
|
||||||
//console.log("the query", query);
|
//console.log("the query", query);
|
||||||
|
|
||||||
const myCases = await getMyCases();
|
const [
|
||||||
const myRepresentations = await getMyRepresentations();
|
myCases,
|
||||||
const watchedCases = await getWatchedCases();
|
myRepresentations,
|
||||||
const awaitingSubmission = await getAwaitingSubmission();
|
watchedCases,
|
||||||
|
awaitingSubmission,
|
||||||
|
] = await Promise.all([
|
||||||
|
await getMyCases(),
|
||||||
|
await getMyRepresentations(),
|
||||||
|
await getWatchedCases(),
|
||||||
|
await getAwaitingSubmission(),
|
||||||
|
]);
|
||||||
|
|
||||||
store.dispatch(setMyCases(myCases));
|
store.dispatch(setMyCases(myCases));
|
||||||
store.dispatch(setMyRepresentations(myRepresentations));
|
store.dispatch(setMyRepresentations(myRepresentations));
|
||||||
|
|||||||
+6
-1
@@ -95,7 +95,11 @@ const makeStore = ({ isServer }) => {
|
|||||||
return createStore(reducer, bindMiddleware([thunkMiddleware]));
|
return createStore(reducer, bindMiddleware([thunkMiddleware]));
|
||||||
} else {
|
} else {
|
||||||
//If it's on client side, create a store which will persist
|
//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 storage = require("redux-persist/lib/storage").default;
|
||||||
|
|
||||||
const persistConfig = {
|
const persistConfig = {
|
||||||
@@ -114,6 +118,7 @@ const makeStore = ({ isServer }) => {
|
|||||||
"watchedCases",
|
"watchedCases",
|
||||||
"form",
|
"form",
|
||||||
],
|
],
|
||||||
|
version: 1,
|
||||||
storage: storage,
|
storage: storage,
|
||||||
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
|
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user