Skip to content

Commit

Permalink
Remove use asyncPropExtenders for /controlpanel route when prefixed
Browse files Browse the repository at this point in the history
The problem of not loading properties occurs in more routes, not just in
/controlpanel. We need a more generic solution. This reverts part of the
commit:

3ad97df
  • Loading branch information
wesleybl committed Mar 14, 2024
1 parent 8d8edf3 commit 9a6b25f
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions packages/volto/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons';

import ConfigRegistry from '@plone/volto/registry';
import { getSystemInformation, listControlpanels } from '@plone/volto/actions';

import { getSiteAsyncPropExtender } from '@plone/volto/helpers';

Expand All @@ -48,7 +47,6 @@ const getServerURL = (url) => {
apiPathURL.port ? `:${apiPathURL.port}` : ''
}`;
};
const prefixPath = process.env.RAZZLE_PREFIX_PATH;

// Sensible defaults for publicURL
// if RAZZLE_PUBLIC_URL is present, use it
Expand Down Expand Up @@ -233,48 +231,6 @@ config.settings.apiExpanders = [
},
];

if (prefixPath) {
const ControlPanelAsyncPropExtender = {
path: `${prefixPath}/controlpanel`,
extend: (dispatchActions) => {
if (
dispatchActions.filter(
(asyncAction) => asyncAction.key === 'controlpanels',
).length === 0
) {
dispatchActions.push({
key: 'controlpanels',
promise: ({ location, store: { dispatch } }) =>
__SERVER__ && dispatch(listControlpanels()),
});
}
return dispatchActions;
},
};
const SystemInfoAsyncPropExtender = {
path: `${prefixPath}/controlpanel`,
extend: (dispatchActions) => {
if (
dispatchActions.filter(
(asyncAction) => asyncAction.key === 'systemInformation',
).length === 0
) {
dispatchActions.push({
key: 'systemInformation',
promise: ({ location, store: { dispatch } }) =>
__SERVER__ && dispatch(getSystemInformation()),
});
}
return dispatchActions;
},
};
config.settings.asyncPropsExtenders = [
...(config.settings.asyncPropsExtenders || []),
ControlPanelAsyncPropExtender,
SystemInfoAsyncPropExtender,
];
}

ConfigRegistry.settings = config.settings;
ConfigRegistry.experimental = config.experimental;
ConfigRegistry.blocks = config.blocks;
Expand Down

0 comments on commit 9a6b25f

Please sign in to comment.