fix(ui): forward forceRender into CollapsibleField's nested RenderFields - #17786
Open
okxint wants to merge 2 commits into
Open
fix(ui): forward forceRender into CollapsibleField's nested RenderFields#17786okxint wants to merge 2 commits into
okxint wants to merge 2 commits into
Conversation
CollapsibleField received the forceRender prop from the field dispatcher but silently dropped it, causing nested fields to never render when document.hidden is true at mount time (backgrounded tabs, embedded webviews, or visibility-throttled automation). Without forceRender, RenderIfInViewport waits on an IntersectionObserver that browsers suppress for hidden documents, so hasRendered stays false indefinitely. Row, Tabs, and Array already forward forceRender correctly; this brings Collapsible in line with those siblings. Fixes payloadcms#17473 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
okxint
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
August 14, 2026 09:45
…cument hidden Adds a Playwright test that overrides document.hidden to true via addInitScript before the page loads, reproducing the condition where IntersectionObserver callbacks are suppressed. Without the forceRender fix, nested fields inside a collapsible would never render under this condition. With the fix they render immediately. Relates to payloadcms#17473 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
What
Closes #17473
CollapsibleFieldreceivesforceRenderfrom the field dispatcher (RenderField.tsx) but never destructures or forwards it — it's silently dropped before reaching the nested<RenderFields>call.Why it matters
Without
forceRender, each nested field is wrapped inRenderIfInViewport, which defers rendering until anIntersectionObserverreports the element as visible. Browsers suspendIntersectionObservercallbacks whendocument.hiddenistrue(backgrounded tabs, embedded webviews, visibility-throttled automation). SohasRenderedstaysfalseindefinitely and the collapsible's children never appear — no error, no warning.DocumentFieldsexplicitly passesforceRender: truefor a document's own fields (at both the main and sidebar call sites), intending that field trees are never subject to lazy viewport-gated rendering.Row,Tabs, andArrayalready honor this by forwarding the prop;Collapsiblewas the only container type that didn't.Fix
Two lines, mirroring the existing pattern in
Row/index.tsx:+ forceRender = false, indexPath,<RenderFields fields={fields} + forceRender={forceRender}Verification