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

@wordpress/block-library WP 6.7: _blockEditor.__experimentalLinkControl.DEFAULT_LINK_SETTINGS is not iterable #68695

Open
3 of 6 tasks
drzraf opened this issue Jan 15, 2025 · 0 comments
Labels
[Type] Bug An existing feature does not function as intended

Comments

@drzraf
Copy link
Contributor

drzraf commented Jan 15, 2025

Description

Bootstrapping blocks (in node) isn't working.

Possibly due to a discrepancy between components/compat' (and their corresponding builds) that went unnoticed in web builds

Step-by-step reproduction instructions

  1. npm i @wordpress/[email protected]
  2. Create globals-test.js, globals-mutation.js and index.js containing:
/*
  // globals-test.js: contains
import { JSDOM } from "jsdom";
global.JSDOM = JSDOM;
global.dom = new JSDOM('<!doctype html><html><body></body></html>');
global.window = dom.window;
global.document = dom.window.document;
*/
import './globals-test.js';

/*
  // globals-mutation.js: contains
  import MutationObserver from 'mutationobserver-shim';
  global.MutationObserver = global.window.MutationObserver;
*/
import './globals-mutation.js';

// npm i @wordpress/[email protected]
import {registerCoreBlocks} from '@wordpress/block-library';
registerCoreBlocks();
  1. (It's just minimum boilerplate code to bootstrap Gutenberg in node: distinct *.js files are needed for ordering global imports)
  2. node index.js

Screenshots, screen recording, code snippet

Actual result

node_modules/@wordpress/block-library/build/button/edit.js:34
const LINK_SETTINGS = [..._blockEditor.__experimentalLinkControl.DEFAULT_LINK_SETTINGS, {
                                                                 ^
TypeError: _blockEditor.__experimentalLinkControl.DEFAULT_LINK_SETTINGS is not iterable
    at Object.<anonymous> (/node_modules/@wordpress/block-library/build/button/edit.js:34:66)
    at Module._compile (node:internal/modules/cjs/loader:1562:14)
    at Object..js (node:internal/modules/cjs/loader:1699:10)
    at Module.load (node:internal/modules/cjs/loader:1313:32)
    at Function._load (node:internal/modules/cjs/loader:1123:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1335:12)
    at require (node:internal/modules/helpers:136:16)
    at Object.<anonymous> (/node_modules/@wordpress/block-library/build/button/index.js:12:36)

Environment info

Dirty workaround, replace _blockEditor.__experimentalLinkControl.DEFAULT_LINK_SETTINGS by an array:

sed -i '/^const LINK_SETTINGS/s!.*!const LINK_SETTINGS = [...(_blockEditor.__experimentalLinkControl.DEFAULT_LINK_SETTINGS || []), {!' node_modules/@wordpress/block-library/build/button/edit.js

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@drzraf drzraf added the [Type] Bug An existing feature does not function as intended label Jan 15, 2025
@drzraf drzraf changed the title @wordpress/block-library WP 6.7: _blockEditor.__experimentalLinkControl.DEFAULT_LINK_SETTINGS is not iterable @wordpress/block-library WP 6.7: _blockEditor.__experimentalLinkControl.DEFAULT_LINK_SETTINGS is not iterable Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant