Fix stale content cache when slots are accessed before render_in#2603
Merged
joelhawksley merged 4 commits intoViewComponent:mainfrom Apr 14, 2026
Merged
Conversation
render_in resets @__vc_content_evaluated but does not clear the cached @__vc_content. If content was evaluated before render_in (e.g. via a slot predicate calling __vc_get_slot), the stale nil is returned on every subsequent call and the render block is silently ignored. Clear @__vc_content in render_in so the cache is fully invalidated. Co-Authored-By: Claude Opus 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.
Problem
contentcaches its result in@__vc_contentafter first evaluation.render_inresets@__vc_content_evaluatedtofalse, but doesn't clear the cached@__vc_contentvalue. This means ifcontentwas evaluated beforerender_in, the stale cached result is returned on every subsequent call — the render block passed when rendering the component is never evaluated.This is easy to trigger in practice because
__vc_get_sloteagerly callscontentto ensure content-defined slots are loaded:So any slot predicate (e.g.
column?,header?) called beforerender_inpoisons the cache. This comes up when building a component's structure first (configuring slots in a helper or setup block) and rendering it later with a content block:Fix
Clear
@__vc_contentinrender_inalongside the existing@__vc_content_evaluatedreset, so the cache is fully invalidated on each render.Adds a regression test that accesses a slot predicate before
render_inand asserts the content block is rendered.