Skip to content

fix(blocks): restore allow-duplicate toggle for static blocks#180

Open
miguelpeixe wants to merge 1 commit into
mainfrom
nppm-2826-content-loop-dedupe-static-toggle
Open

fix(blocks): restore allow-duplicate toggle for static blocks#180
miguelpeixe wants to merge 1 commit into
mainfrom
nppm-2826-content-loop-dedupe-static-toggle

Conversation

@miguelpeixe
Copy link
Copy Markdown
Member

All Submissions:

Changes proposed in this Pull Request:

The "Allow duplicate content" toggle is once again shown on Homepage Posts and Carousel blocks set to Static mode, not only Dynamic mode.

A page-wide deduplication process collects the posts pinned in static blocks and excludes them from dynamic blocks anywhere on the page — including dynamic blocks placed above the static one. The intended way to opt a static block out of that behavior is its "Allow duplicate content" toggle, but a recent change (Automattic/newspack-blocks#2309) moved the toggle into a section that only renders in Dynamic mode, so editors could no longer reach it on static blocks. This restores that control, fixing cases where a post pinned lower on the page disappears from a dynamic loop higher up.

Closes NPPM-2826.

How to test the changes in this Pull Request:

  1. Build the editor bundle: n build newspack-blocks.
  2. Create a post/page. Add a Homepage Posts block at the top, left in Dynamic mode (shows latest posts).
  3. Add a second Homepage Posts block lower on the page, switch it to Static mode, and pin one of the posts that the top dynamic block would naturally display.
  4. View the front end: confirm the pinned post is missing from the top dynamic loop (the bug being addressed).
  5. Back in the editor, select the Static block and confirm the "Allow duplicate content" toggle is now visible in its sidebar (previously hidden in Static mode).
  6. Enable "Allow duplicate content" on the static block and update.
  7. Reload the front end: confirm the pinned post now also appears in the top dynamic loop.
  8. Repeat steps 2–7 using a Carousel block in place of one of the Homepage Posts blocks to confirm the toggle appears for both block types in Static mode.
  9. Confirm Dynamic-mode blocks still show the toggle and behave exactly as before.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores editor access to the “Allow duplicate content” toggle for blocks in Static mode by rendering the toggle outside the Dynamic-only controls section in QueryControls.

Changes:

  • Move the “Allow duplicate content” ToggleControl so it renders for both Static and Dynamic modes (when onAllowDedupeChange is provided).
  • Preserve existing toggle behavior/props (allowDedupeCurrentValue, onAllowDedupeChange) while making the UI reachable in Static mode.

@miguelpeixe miguelpeixe marked this pull request as ready for review June 1, 2026 19:27
@miguelpeixe miguelpeixe requested a review from a team as a code owner June 1, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants