Skip to content

Block error persists after the failing block is edited or replaced #609

Description

@xHayden

Once a block throws, BlockErrorBoundary keeps showing the error for that node id, even after the agent fixes or replaces the block. The message even picks up the new type, e.g. "This sequence block could not be rendered: Cannot read properties of undefined (reading 'from')", even though the error came from the old flow diagram.

Repro (Whiteboard Desktop 0.1.1, via MCP)

  1. Trigger any block render error, e.g. the flow diagram edge-removal crash in Flow diagram throws Cannot read properties of undefined (reading 'from') after an edge is removed #608.
  2. session_edit {"type":"replace","targetId":"<same block id>","content":{"type":"sequence","title":"Repro sequence","actors":{"a":"A","b":"B"},"steps":[{"from":"a","to":"b","label":"call","explanation":"A calls B."}]}}
  3. The block still shows the old error.

Sequence block still showing the flow diagram error

Cause

BlockErrorBoundary sets error in getDerivedStateFromError and never clears it (blocks.tsx#L282-L309). DocumentNode is keyed by node.id (api-document.tsx#L343-L344) and replace keeps the id, so the same boundary instance survives the edit (api-document.tsx#L408-L419).

ReviewDocumentBoundary already handles this by resetting when revision changes (review-document-boundary.tsx#L36-L44).

Possible fix

Give BlockErrorBoundary the same reset, keyed on the block (e.g. pass block or a content revision and clear error in getDerivedStateFromProps when it changes), or key the boundary on the block's type + revision.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions