Skip to content

fix(recipes): single-URL polling root scope + {% template %} double-render - #74

Merged
rbouteiller merged 5 commits into
usetrmnl:mainfrom
mikkel-bergmann:fix/single-url-polling-root-scope
Jun 30, 2026
Merged

fix(recipes): single-URL polling root scope + {% template %} double-render#74
rbouteiller merged 5 commits into
usetrmnl:mainfrom
mikkel-bergmann:fix/single-url-polling-root-scope

Conversation

@mikkel-bergmann

@mikkel-bergmann mikkel-bergmann commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Two fixes for Liquid recipe rendering (surfaced by the "XKCD Comic with Hover text" recipe).

1. Single-URL polling data not at root scope

A recipe with one polling_url must expose the response JSON's keys at the root scope ({{ img }}), matching TRMNL. fetchPollingData namespaced even a single URL under IDX_0, so vars were empty and the recipe rendered its fallback. Root-merge IDX_0 when there's exactly one URL; multi-URL keeps IDX_0/IDX_1.

2. {% template %} blocks rendered twice

{% template name %} only defines a reusable block, but TemplateTag.render emitted its body inline at definition time — so a layout calling {% render "name" %} rendered it twice (comic appeared duplicated and half-size). Definition now emits nothing.

🤖 Generated with Claude Code

@mikkel-bergmann mikkel-bergmann changed the title fix(recipes): expose single-URL polling data at root scope fix(recipes): single-URL polling root scope + {% template %} double-render Jun 22, 2026
@rbouteiller
rbouteiller force-pushed the fix/single-url-polling-root-scope branch from 7491e54 to 9f8ec04 Compare June 30, 2026 15:49
yoink and others added 5 commits June 30, 2026 18:51
A Liquid recipe with one polling_url must expose the response JSON's
keys at the root scope (e.g. {{ img }}), matching TRMNL. fetchPollingData
namespaced even a single URL under IDX_0, so single-URL recipes (e.g.
"XKCD Comic with Hover text") got empty variables and rendered their
fallback. Root-merge IDX_0 when there is exactly one URL; multi-URL
recipes keep IDX_0/IDX_1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
{% template name %} only DEFINES a reusable block; it must emit nothing
at definition time. TemplateTag.render emitted the block body inline, so
a recipe whose layout also called {% render "name" %} rendered the block
twice (e.g. the XKCD comic appeared duplicated and half-size). Make the
definition emit nothing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rbouteiller
rbouteiller force-pushed the fix/single-url-polling-root-scope branch from 9f8ec04 to 590a060 Compare June 30, 2026 15:52
@rbouteiller
rbouteiller merged commit 2511a20 into usetrmnl:main Jun 30, 2026
3 checks passed
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.

3 participants