Skip to content

Commit

Permalink
Fixed circular import error in dev with HMR in core Views and Widgets…
Browse files Browse the repository at this point in the history
… shadow customizations
  • Loading branch information
sneridagh committed Dec 9, 2024
1 parent 6b78429 commit 7728cd3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
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);

0 comments on commit 7728cd3

Please sign in to comment.