Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed circular import error in dev with HMR in App component when imported in the main default config #6524

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/volto/news/6524.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed circular import error in dev with HMR in `App` component when imported in the main default config. @sneridagh
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);
Loading