close
Skip to content

useSettings initially returns undefined in WP 7.0 #78888

Description

@cr0ybot

Description

The issue has been isolated to attempting to destructure the return value of useSettings(). Prior to WP 7.0 this did not seem to be an issue, but now it reliably returns undefined on first render. Original description left intact below:

After installing WordPress 7.0, some custom functionality using useSettings (from @wordpress/block-editor) that was previously working started throwing an error. The exact error is not terribly enlightening:

TypeError: i.useSettings(...)[Symbol.iterator]().next().value is undefined

This is the line that is failing in a demo theme repo: https://github.com/cr0ybot/theme-typography-presets-demo/blob/701933d77ef9dd73b5185bdfe77d940f6cf470ca/src/editor.js#L130

I was able to work around the issue by replacing this:

const [ { typographyPreset: presets } ] = useSettings( [ 'custom' ] );

...with this:

const presets = useSelect( ( select ) => {
	const { getEditorSettings } = select( 'core/editor' );
	const { custom } = getEditorSettings()?.__experimentalFeatures ?? {};
	return custom?.typographyPreset;
}, [] );

Note that I have also tried useSettings( 'custom' ) without the path in an array, it makes no difference.

Step-by-step reproduction instructions

  1. Spin up a new WordPress instance
  2. Install the typography presets demo theme: https://github.com/cr0ybot/theme-typography-presets-demo
  3. Open the default post and observe that all paragraph blocks have encountered an error.

Screenshots, screen recording, code snippet

https://github.com/cr0ybot/theme-typography-presets-demo

Screen.Recording.2026-06-02.at.2.32.37.PM.mov

Environment info

  • WordPress 7.0, Gutenberg plugin not installed

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Package] Block editor/packages/block-editor[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