Skip to content

Add stable persisted IDs for block-array items #931

Description

@bobbwal

Problem

Blocks in arrays such as pages.blocks have blockType and position, but no stable per-block ID. That means frontend
consumers can only target blocks by type or index, and index changes on reorder.

Repro

  1. Create a page with multiple blocks.
  2. Render them in Astro with DOM hooks.
  3. Reorder blocks in the CMS.
  4. Any index-based selector/hook now points at a different block.

Proposal

Add a persisted internal ID for each block item in discriminated block arrays.

Requirements:

  • generated once when a block is created
  • stored with the block data
  • preserved on reorder/edit/save
  • available in fetched content
  • hidden from normal editorial UI if possible

Example

Current:

{ "blockType": "hero", "heading": "Welcome" }

Desired:

  { "blockId": "blk_abc123", "blockType": "hero", "heading": "Welcome" }

Acceptance criteria

  • new block items receive a stable persisted ID
  • reorder does not change the ID
  • edits do not change the ID
  • fetched content includes the ID
  • existing content has a backfill/migration path

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions