Skip to content

Commit

Permalink
Fixed circular import error in dev with HMR in App component when i…
Browse files Browse the repository at this point in the history
…mported in the main default config.
  • Loading branch information
sneridagh committed Dec 8, 2024
1 parent d4d00d5 commit 4fbea39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
15 changes: 9 additions & 6 deletions packages/volto/src/config/Components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import App from '@plone/volto/components/theme/App/App';
import PreviewImage from '@plone/volto/components/theme/PreviewImage/PreviewImage';
import Image from '@plone/volto/components/theme/Image/Image';

// Register components.
export const components = {
PreviewImage: { component: PreviewImage },
App: { component: App },
Image: { component: Image },
};
export function installDefaultComponents(config) {
config.components = {
PreviewImage: { component: PreviewImage },
App: { component: App },
Image: { component: Image },
};

return config;
}
5 changes: 3 additions & 2 deletions packages/volto/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
initialBlocks,
initialBlocksFocus,
} from './Blocks';
import { components } from './Components';
import { loadables } from './Loadables';
import { workflowMapping } from './Workflows';
import slots from './slots';
Expand All @@ -33,6 +32,7 @@ import {
import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons';

import ConfigRegistry from '@plone/volto/registry';
import { installDefaultComponents } from './Components';

import { getSiteAsyncPropExtender } from '@plone/volto/helpers/Site';
import { registerValidators } from './validation';
Expand Down Expand Up @@ -216,7 +216,7 @@ let config = {
},
addonRoutes: [],
addonReducers: {},
components,
components: {},
slots: {},
utilities: {},
};
Expand Down Expand Up @@ -261,5 +261,6 @@ Object.entries(slots).forEach(([slotName, components]) => {
});

registerValidators(ConfigRegistry);
installDefaultComponents(ConfigRegistry);

applyAddonConfiguration(ConfigRegistry);

0 comments on commit 4fbea39

Please sign in to comment.