Repository navigation
Keep executor when chained page contributions end with a non-hydrated component - #2323
Open
alansemenov wants to merge 1 commit into
Open
alansemenov wants to merge 1 commit into
alansemenov wants to merge 1 commit into
Conversation
… 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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 6.x #2323 +/- ##
======================================
Coverage ? 22.85%
======================================
Files ? 1
Lines ? 35
Branches ? 0
======================================
Hits ? 8
Misses ? 27
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fix correctly addresses the reported regression and includes adequate test coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Preserves the React4XP executor when chained page contributions end with a non-hydrated component.
Changes:
- Retains and repositions an existing executor last.
- Adds coverage for suppression, retention, ordering, and deduplication.
| File | Description |
|---|---|
getAndMerge.ts |
Preserves the executor across chained contributions. |
getAndMerge.test.ts |
Tests executor retention and deduplication. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes #2322
Problem
In the custom flow, when the result of one
renderPageContributionscall is passed aspageContributionsinto the next, the executor script is dropped as soon as a later call is for a component that does not need JS (ssrwithouthydrate, or Content Studio edit mode). A hydratedHeaderfollowed by a staticFooterleavesHeaderun-hydrated: its asset and JSON trigger are in the page, but nothing runs them.getAndMergeseeds the dedup control set with the executor tag so it can be appended last, which strips it from the incoming contributions, and then only re-appends it when the current call hassuppressJS === false.Fix
Re-append the executor when the current call needs it or the incoming
bodyEndalready contained it. The executor still lands last and is still never duplicated.Tests
New
src/jest/server/pageContributions/getAndMerge.test.tscovers: executor appended last, not appended when nothing needs it, kept when an earlier rendering needed it and the last one suppresses JS (fails without the fix), and not duplicated when two renderings both need it.Targets
6.xsince the reporting customer is on React4XP 6. The same code exists unchanged on7.xandmaster, so this should be forward-ported.🤖 Generated with Claude Code