Skip to content

Commit

Permalink
Fixed circular import error in dev with HMR in core Blocks shadow cus…
Browse files Browse the repository at this point in the history
…tomizations (#6525)
  • Loading branch information
sneridagh authored Dec 9, 2024
1 parent 6384312 commit 1cfdda6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/volto/news/6525.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed circular import error in dev with HMR in core Blocks shadow customizations. @sneridagh
9 changes: 9 additions & 0 deletions packages/volto/src/config/Blocks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,15 @@ const requiredBlocks = ['title'];
const initialBlocks = {};
const initialBlocksFocus = {}; //{Document:'title'}

export function installDefaultBlocks(config) {
config.blocks.requiredBlocks = requiredBlocks;
config.blocks.blocksConfig = blocksConfig;
config.blocks.groupBlocksOrder = groupBlocksOrder;
config.blocks.initialBlocks = initialBlocks;
config.blocks.initialBlocksFocus = initialBlocksFocus;
config.blocks.showEditBlocksInBabelView = false;
}

export {
groupBlocksOrder,
requiredBlocks,
Expand Down
20 changes: 4 additions & 16 deletions packages/volto/src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ConfigRegistry from '@plone/volto/registry';
import { parse as parseUrl } from 'url';
import { defaultWidget, widgetMapping } from './Widgets';
import {
Expand All @@ -9,13 +10,6 @@ import {
} from './Views';
import { nonContentRoutes } from './NonContentRoutes';
import { nonContentRoutesPublic } from './NonContentRoutesPublic';
import {
groupBlocksOrder,
requiredBlocks,
blocksConfig,
initialBlocks,
initialBlocksFocus,
} from './Blocks';
import { loadables } from './Loadables';
import { workflowMapping } from './Workflows';
import slots from './slots';
Expand All @@ -31,8 +25,8 @@ import {

import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons';

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

import { getSiteAsyncPropExtender } from '@plone/volto/helpers/Site';
import { registerValidators } from './validation';
Expand Down Expand Up @@ -206,14 +200,7 @@ let config = {
errorViews,
layoutViewsNamesMapping,
},
blocks: {
requiredBlocks,
blocksConfig,
groupBlocksOrder,
initialBlocks,
initialBlocksFocus,
showEditBlocksInBabelView: false,
},
blocks: {},
addonRoutes: [],
addonReducers: {},
components: {},
Expand Down Expand Up @@ -262,5 +249,6 @@ Object.entries(slots).forEach(([slotName, components]) => {

registerValidators(ConfigRegistry);
installDefaultComponents(ConfigRegistry);
installDefaultBlocks(ConfigRegistry);

applyAddonConfiguration(ConfigRegistry);

0 comments on commit 1cfdda6

Please sign in to comment.