Skip to content

Commit

Permalink
fix: mismatch from ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Jun 11, 2024
1 parent 289aec6 commit 02f1db7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import { RESET_SUBSITE, SET_SUBSITE } from '../actions';
import { GET_CONTENT } from '@plone/volto/constants/ActionTypes';

const initialState = {
error: null,
Expand All @@ -13,6 +14,7 @@ const initialState = {
};

export const subsiteReducer = (state = initialState, action = {}) => {
let { result } = action;
switch (action.type) {
// DEPRECATED
// case `${GET_SUBSITE}_PENDING`:
Expand All @@ -35,11 +37,24 @@ export const subsiteReducer = (state = initialState, action = {}) => {
// hasError: true,
// loadingResults: false,
// };
case `${GET_CONTENT}_SUCCESS`:
if (!action.subrequest) {
const data = result;
const subsite = data?.['@components']?.subsite;
return {
...state,
data: subsite,
};
} else {
return {
...state,
};
}
case SET_SUBSITE:
const { payload } = action;
return {
...state,
data: payload.subsite,
data: payload?.subsite,
};
case RESET_SUBSITE:
return {
Expand Down

0 comments on commit 02f1db7

Please sign in to comment.