Skip to content

Keep executor when chained page contributions end with a non-hydrated component (7.x) - #2324

Open
alansemenov wants to merge 1 commit into
7.xfrom
executor-chain-2322-7.x
Open

alansemenov wants to merge 1 commit into
7.xfrom
executor-chain-2322-7.x

Conversation

@alansemenov

Copy link
Copy Markdown
Member

Fixes #2322

Forward-port of #2323 to 7.x. The affected code in getAndMerge is identical on both branches.

Problem

In the custom flow, when the result of one renderPageContributions call is passed as pageContributions into the next, the executor script is dropped as soon as a later call is for a component that does not need JS (ssr without hydrate, or Content Studio edit mode). A hydrated Header followed by a static Footer leaves Header un-hydrated.

Fix

Re-append the executor when the current call needs it or the incoming bodyEnd already contained it. The executor still lands last and is never duplicated.

Tests

New src/jest/server/pageContributions/getAndMerge.test.ts, same as in #2323. The chained case fails without the fix and passes with it.

🤖 Generated with Claude Code

… component #2322

getAndMerge strips the executor from incoming page contributions so
it can be appended last, but only re-added it when the current
rendering needed JS. A chain ending with an SSR-only component
therefore lost the executor that an earlier hydrated component
depended on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.85%. Comparing base (61f337c) to head (fcd5d15).

Additional details and impacted files
@@           Coverage Diff           @@
##              7.x    #2324   +/-   ##
=======================================
  Coverage   22.85%   22.85%           
=======================================
  Files           1        1           
  Lines          35       35           
=======================================
  Hits            8        8           
  Misses         27       27           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused fix addresses the reported regression and is adequately covered by tests.

Review effort: Balanced
Findings: None

What changed in this PR

Preserves the hydration executor across chained page contributions when later components suppress JavaScript.

Changes:

  • Retains and repositions an existing executor last.
  • Adds regression and deduplication tests.
File Description
getAndMerge.ts Preserves the executor during chained merges.
getAndMerge.test.ts Tests retention, ordering, suppression, and deduplication.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Chained renderPageContributions drops the executor when the last component has hydrate disabled

2 participants