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 core Views and Widgets shadow customizations #6526

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/6526.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed circular import error in dev with HMR in core Views and Widgets shadow customizations. @sneridagh
10 changes: 10 additions & 0 deletions packages/volto/src/config/Views.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,13 @@ export const layoutViewsNamesMapping = {
view: 'Default view',
default: 'Default view',
};

export function installDefaultViews(config) {
config.views.layoutViews = layoutViews;
config.views.contentTypesViews = contentTypesViews;
config.views.defaultView = defaultView;
config.views.errorViews = errorViews;
config.views.layoutViewsNamesMapping = layoutViewsNamesMapping;

return config;
}
5 changes: 5 additions & 0 deletions packages/volto/src/config/Widgets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,8 @@ export const widgetMapping = {

// Default Widget
export const defaultWidget = TextWidget;

export function installDefaultWidgets(config) {
config.widgets = widgetMapping;
config.widgets.default = defaultWidget;
}
25 changes: 6 additions & 19 deletions packages/volto/src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import ConfigRegistry from '@plone/volto/registry';
import { parse as parseUrl } from 'url';
import { defaultWidget, widgetMapping } from './Widgets';
import {
layoutViews,
contentTypesViews,
defaultView,
errorViews,
layoutViewsNamesMapping,
} from './Views';
import { nonContentRoutes } from './NonContentRoutes';
import { nonContentRoutesPublic } from './NonContentRoutesPublic';
import { loadables } from './Loadables';
Expand All @@ -26,6 +18,8 @@ import {
import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons';

import { installDefaultComponents } from './Components';
import { installDefaultWidgets } from './Widgets';
import { installDefaultViews } from './Views';
import { installDefaultBlocks } from './Blocks';

import { getSiteAsyncPropExtender } from '@plone/volto/helpers/Site';
Expand Down Expand Up @@ -189,17 +183,8 @@ let config = {
enabled: true,
},
},
widgets: {
...widgetMapping,
default: defaultWidget,
},
views: {
layoutViews,
contentTypesViews,
defaultView,
errorViews,
layoutViewsNamesMapping,
},
widgets: {},
views: {},
blocks: {},
addonRoutes: [],
addonReducers: {},
Expand Down Expand Up @@ -249,6 +234,8 @@ Object.entries(slots).forEach(([slotName, components]) => {

registerValidators(ConfigRegistry);
installDefaultComponents(ConfigRegistry);
installDefaultWidgets(ConfigRegistry);
installDefaultViews(ConfigRegistry);
installDefaultBlocks(ConfigRegistry);

applyAddonConfiguration(ConfigRegistry);
Loading