Skip to content

fix(ui): rerender pasted block rows#17379

Open
AkhilTrivediX wants to merge 2 commits into
payloadcms:mainfrom
AkhilTrivediX:codex/fix-block-paste-render
Open

fix(ui): rerender pasted block rows#17379
AkhilTrivediX wants to merge 2 commits into
payloadcms:mainfrom
AkhilTrivediX:codex/fix-block-paste-render

Conversation

@AkhilTrivediX

Copy link
Copy Markdown

Summary

  • Clear stale lastRenderedPath metadata when serializing copied form fields and nested rows.
  • Ensure same-path block-row pastes trigger component rendering instead of leaving the block body blank.

Root cause

Clipboard data preserved render-location metadata while intentionally omitting non-serializable custom components. When a copied block row was pasted back to the same path, the stale render path matched the target path and skipped the server render required to restore those components.

Fixes #17375.

Validation

  • pnpm exec vitest run --project unit packages/ui/src/elements/ClipboardAction/mergeFormStateFromClipboard.spec.ts --reporter=dot
  • pnpm exec prettier --check packages/ui/src/elements/ClipboardAction/mergeFormStateFromClipboard.ts packages/ui/src/elements/ClipboardAction/mergeFormStateFromClipboard.spec.ts
  • Regression test fails against the previous serializer and passes with this change.

@JarrodMFlesch

Copy link
Copy Markdown
Contributor

Can you add a e2e test that shows the failure before this change was made?

@AkhilTrivediX

Copy link
Copy Markdown
Author

Added an end-to-end regression assertion in test/fields/collections/Blocks/e2e.spec.ts.

The existing same-row copy/paste scenario now verifies that the block's rich-text editor is visible both before and after pasting the copied row back onto itself. This covers the blank block-body behavior caused by retaining lastRenderedPath for the same target path.

The update is in aecb30d. The PR checks triggered by the new commit are passing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pasting a copied blocks row renders the block blank until page refresh

2 participants