Conversation
Contributor
|
Preview deployment: https://duplicate-to-enhance.preview.avy-fx.org |
busbyk
reviewed
Mar 17, 2026
Collaborator
busbyk
left a comment
There was a problem hiding this comment.
One relationship removal isn't working (ButtonBlock inside of a richText field in EventList (likely BlogList too)): https://www.loom.com/share/777dddf99b784ec7b60e67ffa792a844
src/collections/Pages/components/DuplicatePageFor/DuplicatePageForDrawer.tsx
Show resolved
Hide resolved
2761497 to
3998f1b
Compare
3998f1b to
392fd0a
Compare
392fd0a to
07202a7
Compare
…. Will now create blank pages and publish pages and nav.
07202a7 to
b9a64fb
Compare
Collaborator
Author
Good catch! I added |
… were not included in `DEFAULT_BLOCKS`
busbyk
reviewed
Mar 23, 2026
…tion - remove skipped detail
busbyk
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Improves the page duplication and provisioning logic introduced in #974. The
clearLayoutRelationshipsutility properly clears relationship and upload fields from any block — keeping the block structure intact and letting editors repopulate the tenant-specific references.Provisioning is now driven by DVAC's navigation structure. It queries the template tenant's published navigation to determine which pages and built-in pages to create — only pages referenced in navigation are provisioned. Pages are created as blank published pages (title, slug, empty content block) with no copied content. Built-in pages are also filtered to those referenced in the navigation. Navigation and all pages are published immediately. The
duplicatePageToTenantaction still usesclearLayoutRelationshipsto copy layout structure while clearing tenant-specific references, and now only appends " - Copy" to the title/slug when a page with the same slug already exists for the target tenant.The
clearLayoutRelationshipsutility currently handles all field types in Payload's schema (group,array,tabs,row,collapsible,richTextwith Lexical blocks), including Lexical-embedded blocks likeButtonBlockandCalloutBlock. If new field container types are added to Payload in the future, the utility would need updating.Related Issues
Part of #533 (follow-up to #974)
Closes #625
Key Changes
extractNavReferences. Only pages and built-in pages that appear in the navigation are created for the new tenant. If DVAC's navigation changes, provisioning automatically adjusts.clearLayoutRelationshipsutility — recursively clearsrelationshipanduploadfields from any block in a page layout (including nested groups, arrays, tabs, and Lexical rich-text blocks withButtonBlockandCalloutBlock), keeping structure intact so editors repopulate tenant-specific references after duplication.duplicatePageToTenantnow only appends " - Copy" to the title and "-copy" to the slug when a page with the same slug already exists for the target tenant.duplicatePageToTenantwas spreading the cleaned layout array intodatainstead of assigning it asdata.layout.clearLayoutRelationships(relationships, uploads, groups, arrays, tabs, Lexical blocks, id stripping) and integration tests forduplicatePageToTenant(slug conflict and no-conflict cases), backed by a sharedfixtures/mockBlocks.ts.How to test
Added tests
pnpm seedto get a fresh database with the DVAC template tenantScreenshots / Demo video
Duplicate page to... demo
Provisioning tenant demo
Migration Explanation
No schema changes — no migration needed.
Future enhancements
Should we include
ButtonBlock&CalloutBlockinDEFAULT_BLOCKS? They are the only 2 not included. #1001