Client: Properly address a slot inside markup a helper like content_for captured - #2275
Merged
Conversation
|
View your CI Pipeline Execution ↗ for commit a2f4b20
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
marcoroth
force-pushed
the
slots/displaced
branch
from
August 18, 2026 02:57
fe97c6d to
a2f4b20
Compare
🌿 Interactive Playground and Documentation PreviewA preview deployment has been built for this pull request. Try out the changes live in the interactive playground: 🌱 Grown from commit ✅ Preview deployment has been cleaned up. |
commit: |
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.
This pull request makes a slot addressable when
content_for,provideorcapturemoved it away from the template that numbered it.Those helpers run during one rendering and hand their markup to whoever wants it, which is usually somewhere else on the page. The markers go with it, so a slot ended up outside the markers of the template that numbered it, and the client, attributing slots by where they sit, gave it to whatever enclosed it instead. The value for it was in the payload the whole time and nothing could find the place to put it.
Captured markup carries its own region marker now, naming the same template, version and rendering as the template around it, so it says where it belongs wherever it is emitted. It reads the number instead of counting again, which is what makes it the same rendering and not another one.
On the client, a region is no longer a stretch of the page between two markers. A rendering is identified by its template, version and number, so two markers naming the same one are the same one. A region holds a list of ranges, is kept while any of them is still on the page, and contains a node that any of them contains. Nothing about addressing changes: a slot inside a
content_forisslots.slot(file, index)like any other, however far from the rest of its template it ended up.Matching by name only covers the helpers that can be named. A helper that captures its block privately is indistinguishable from one that renders it in place, and no amount of reading the ERB will tell them apart. Matching one that renders in place costs a marker pair saying something true, so this errs towards matching.
On RubyEvents' announcements page the head now carries the action template's marker fifty thousand characters from the rest of it, and the slot inside is addressable as that template's and not as the layout's.