Skip to content

fix(cms): seed entryStack from originating page path in dynamic hole endpoint (#548) - #552

Open
ShreyasUday wants to merge 2 commits into
CoreBunch:mainfrom
ShreyasUday:fix/seed-entry-stack-in-holes
Open

ShreyasUday wants to merge 2 commits into
CoreBunch:mainfrom
ShreyasUday:fix/seed-entry-stack-in-holes

Conversation

@ShreyasUday

Copy link
Copy Markdown

Summary

Fixes #548 (split out from #546).

When dynamic Layer C holes are hydrated via /_instatic/hole/<nodeId>?v=<version>&u=<page-url>, renderHoleFragment in server/handlers/cms/hole.ts previously hardcoded entryStack: [].

As a result, {currentEntry.*} bindings inside dynamic hole subtrees (such as loop cell filters mixing {currentEntry.slug} and {route.query.*}) resolved to empty strings "". For example, a filter like "{currentEntry.slug}-{route.query.region}" on /courses/time-management?region=cz evaluated to "-cz", causing queries to return no records and render empty.

This change:

  • Adds resolveOriginatingEntry in server/handlers/cms/hole.ts using contentRouteFromPath(pageUrl.pathname) and getPublishedDataRowByRoute to look up the published entry row.
  • Seeds templateContext.entryStack with [entryRow] when an entry row matches, allowing {currentEntry.*} bindings to resolve seamlessly inside dynamic holes.
  • Safely falls back to entryStack = [] if the page path is not a content entry route.

Verification

  • bun run build
  • bun test
  • bun run lint
  • Docker/deployment check, if relevant

Checklist

  • Tests cover behavior changes.
  • Docs were updated when behavior, config, deployment, or public surfaces changed.
  • No compatibility shim was added for old pre-release behavior.
  • No secrets, local databases, uploads, or generated artifacts are included.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loop filter mixing {route.query.*} with {currentEntry.*} renders empty

1 participant