Repository navigation
fix(loops): iterate repeater sub-fields and publish bound media URLs - #648
Draft
invisibletype wants to merge 1 commit into
Draft
invisibletype wants to merge 1 commit into
invisibletype wants to merge 1 commit into
Conversation
…edia URLs
Repeater items ({ id, cells }) now expose their cells as loop item fields,
so a loop nested in a repeater loop can iterate an item's own multi-value
sub-field (a case-study block's images), and the Loop panel offers repeater
fields plus a repeater's sub-fields inside a repeater loop.
base.image and base.video now take src from the resolved media asset, so a
src bound to a media field publishes the asset URL instead of its id.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Requested by Arlo
Summary
Before: a loop nested inside a loop over a repeater field rendered nothing, so a case study's blocks could not each list their own images. The Loop panel did not offer repeater fields at all. And an Image (or Video) whose source was bound to a media field published the asset id as
src(src="zz4G2c…"), with onlysrcsetpointing at real files.After: repeater items expose their cells as loop item fields, so
{currentEntry.layout}reads a block's value and a nested Current entry field loop can iterate that block'simages. The Field picker offers repeater fields, and inside a repeater loop it offers that repeater's multi-value sub-fields. Bound images and videos publish the resolved asset URL insrc.How:
src/core/loops/sources/entryField.ts:projectItemrecognisesRepeaterItemSchemaitems and spreadscellsinto the item fields (the original item stays atvalue). This is a deliberate shape change: bindings that reached intocells.*now read the sub-field directly.LoopPropertiesView.tsx: the entry-field picker resolves context from the nearest enclosing loop. Under anentry.fieldrepeater loop it lists that repeater's sub-fields, otherwise the context tables' collection fields, now including repeaters.base.image/base.video:srcprefers_resolvedMediaByKey[...].publicPath. Authored URLs resolve to an asset with the same path, so their output is unchanged.docs/features/loops.md: picker behaviour plus a "case-study blocks from a repeater" recipe.Checked end to end on a local SQLite instance: a post type with a
blocksrepeater (layout select + multi-media images), an entry template with a blocks loop, adata-layout="{currentEntry.layout}"section, and a nested images loop. Every block published only its own images with/uploads/...srcvalues.Verification
bun run build: passesbun test: the changed suites pass (153 tests). The new repeater and nested-loop tests fail without the fix. The full run on Windows has 24 failures that are unrelated: symlink EPERM, missing server-artifact binaries, one SQLite timeout, and architecture gates on files outside this diff.src/__tests__/architecturegives the same 9 failures with and without this change.bun run lint: passesChecklist
🤖 Generated with Claude Code