Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleteBlock helper doesn't handle the case where the layout is empty after a delete but there are already existing blocks #6752

Open
4 tasks
JeffersonBledsoe opened this issue Feb 13, 2025 · 0 comments · May be fixed by #6753
Labels
01 type: bug 30 needs: triage New issue that needs confirmation before work begins

Comments

@JeffersonBledsoe
Copy link
Member

Describe the bug

The deleteBlocks helper function has a functionality where if the blocks_layout key is empty after deletion, it will create a new block with the

if (newFormData[blocksLayoutFieldname].items.length === 0) {
newFormData = addBlock(
newFormData,
config.settings.defaultBlockType,
0,
{},
intl,
);
}

Possible solutions

  • Leave it as is
    • Can lead to odd behaviour where you have block definitions stored that aren't used in the layout
  • Leave it as is and delete the existing block data
    • Could lead to possible removal of wanted data
  • Add all of the existing blocks back into the layout.
    • It may end up with a messy layout, but at least it becomes clear what is stored and what isn't
  • Check if any of the existing blocks are match the default block type and add that. Fallback to one of the above behaviours if not
@JeffersonBledsoe JeffersonBledsoe added 01 type: bug 30 needs: triage New issue that needs confirmation before work begins labels Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
01 type: bug 30 needs: triage New issue that needs confirmation before work begins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant