Skip to content

Site editor: Cannot read properties of undefined (reading 'getAlignments') #35498

@ribaricplusplus

Description

@ribaricplusplus

Description

I get the following error (and also the query block doesn't work) when I try to open the Site Editor while doing development on tt1-blocks:

use-available-alignments.js:34 Uncaught TypeError: Cannot read properties of undefined (reading 'getAlignments')
    at useAvailableAlignments (index.min.js:9375)
    at index.min.js:38282
    at renderWithHooks (react-dom.development.js:15015)
    at mountIndeterminateComponent (react-dom.development.js:17841)
    at beginWork (react-dom.development.js:19079)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3942)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3991)
    at invokeGuardedCallback (react-dom.development.js:4053)
    at beginWork$1 (react-dom.development.js:23994)
    at performUnitOfWork (react-dom.development.js:22806)

I created an issue here because the error happens in Gutenberg files so it's probably not a thing that the tt1-theme can do anything about. Maybe it's caused by some theme.json settings or I just did something wrong?

Important note this doesn't happen when I create a similar setup to do development on twentytwentytwo (https://github.com/WordPress/twentytwentytwo)

Step-by-step reproduction instructions

I tried to do development on tt1-blocks from the theme-experiments repository (https://github.com/WordPress/theme-experiments). So I first cloned that repo (commit 304e6ef).

I used @wordpress/env to setup a server by adding this .wp-env.json to theme-experiments repository:

{
    "core": "WordPress/WordPress",
    "themes": [ "./tt1-blocks" ],
    "plugins": [ "/home/bruno/useful/gutenberg" ]
}

/home/bruno/useful/gutenberg is the path to the Gutenberg repository at commit cb71bf3 (latest commit at the time of writing this issue). This issue also appears if I install Gutenberg normally from WP admin rather than using wp-env.

Run wp-env start, activate tt1-blocks, and navigate to the Site editor. The error in the description appears and the query block doesn't work.

Screenshots, screen recording, code snippet

Screenshot of the error:

2021-10-11_11-14

Query block not working:

2021-10-11_11-16

Environment info

  • Opearing system: Debian
  • Latest WordPress version (checked out by @wordpress/env)
  • Gutenberg at commit cb71bf3 but it happens with other versions too

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions