Skip to content

Replace unstable__bootstrapServerSideBlockDefinitions with call to block type REST API #22812

Open

Description

@spacedmonkey

Part of #41236.

Currently in WordPress core the follow lines appear.

// Preload server-registered block schemas.
wp_add_inline_script(
	'wp-blocks',
	'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
);

This was a workaround added in WordPress 5.0. Now that the block types endpoint was added in #21065 , this should be used as the "point of truth" for block definitions.

Describe the solution you'd like
The block types api should be preloaded on the page by adding it to this array.

Activity

  1. added
    [Feature] Block API
    REST API Interaction
    on Jun 1, 2020
  2. aduth commented on Jun 1, 2020

    @aduth
    Member

    This would be a good application of the new block types endpoint. 👍

    As far as implementation, it's unclear to me in how @wordpress/blocks remains rather agnostic to the source of block type definitions whether it should be the point where the implementation occurs.

    Instead, it may be something that ought to occur elsewhere in the editor initialization where this sort of integration would be appropriate.

    For example, one of:

    In any case, the implementation should use the new REST API endpoint, in combination with @wordpress/api-fetch (see mentioned preloading in original comment) and possibly (ideally?) as a reusable data entity from @wordpress/core-data.

  3. added
    Needs Dev
    [Type] Task
    on Jun 2, 2020
  4. added
    [Status] In Progress
    on Oct 25, 2021
  5. self-assigned this
    on Oct 25, 2021
  6. moved this to Todo in WordPresson Nov 24, 2021
  7. moved this from Todo to In Progress in WordPresson Jan 4, 2022
  8. moved this from In Progress to Todo in WordPresson Jan 10, 2022
  9. removed
    [Status] In Progress
    on Jan 13, 2022
  10. removed their assignment
    on Jan 13, 2022
  11. spacedmonkey commented on Jan 3, 2024

    @spacedmonkey
    MemberAuthor

    @gziolo @Mamaduka Any chance we could get eyes on this ticket?

  12. Mamaduka commented on Jan 4, 2024

    @Mamaduka
    Member

    @spacedmonkey, chatted briefly with @gziolo about this ticket and WordPress/wordpress-develop#5718 (comment). Agreed that the source of the truth should be REST API for the editors, whenever possible.

    @kt-12 mentioned that some information is missing for dynamic blocks returned via API.

    It would also be nice to see performance metrics when preloading data via block_editor_rest_api_preload vs. get_block_editor_server_block_settings.

    cc @@joemcgill

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs DevREST API Interaction[Feature] Block API[Type] Task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions