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
  • Loading branch information
sneridagh committed Dec 9, 2024
1 parent 6384312 commit a092907
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
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 a092907

Please sign in to comment.