Skip to content

Editing post in Text Mode causes shared blocks to go away #5754

@noisysocks

Description

@noisysocks

Issue Overview

If you edit a post using Text Mode, any shared blocks will appear as though they have been deleted when you return to Visual Mode.

Steps to Reproduce (for bugs)

  1. Create a new post
  2. Create or insert a Shared Block
  3. Switch to Text Mode
  4. Make an edit, e.g. add a line of text
  5. Return to Visual Mode

Expected Behavior

The Shared Block should render properly in the visual editor.

Current Behavior

The Shared Block appears as though it has been deleted.

Possible Solution

This is because RESET_BLOCKS is dispatched when PostTextEditor is blurred. This has the unintended side effect of deleting the block that the Shared Block is referencing.

One solution is to change RESET_BLOCKS so that it doesn't delete any blocks in blocksByUid that are referenced by orderedBlocks or reusableBlocks.

cc. @aduth

Screenshots / Video

bug

Related Issues and/or PRs

#5228 introduced this bug. I discovered this while debugging #2978 which is vaguely related.

Metadata

Metadata

Assignees

Labels

[Feature] Synced PatternsRelated to synced patterns (formerly reusable blocks)[Priority] HighUsed to indicate top priority items that need quick attention[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions