Skip to content

renderJson: lazyUrl format differs from Fresh (/deco/render?format=json… vs /<path>?renderJson&__section=N) #650

Open

Description

@aline-pereira

What

The ?renderJson page envelope emits deferred (lazy) sections as { component, lazyUrl } placeholders the mobile app fetches on demand. The URL format differs between the two runtimes:

Runtime lazyUrl
Fresh / deco-runtime (runtime/routes/serialize-section.ts, buildLazyUrl) /deco/render?format=json&props={"loading":"eager"}&href=<page url>&pathTemplate=<template>&resolveChain=<minified chain>[&renderSalt=…][&__cb=…]
@decocms/tanstack (workerEntry.ts, lazyUrlFor) /<page path>?<page query>&renderJson=&__section=<index>

Both resolve to the same { component, props } body, but the contract the app sees changes: a client that parses or rewrites lazyUrl (e.g. to append its own params, cache by resolveChain, or route /deco/render differently from page URLs) built against Fresh breaks on TanStack. Measured on deco-sites/oficina-tanstack: Home has 6–8 lazy placeholders, the PDP 4, /the-post 6–10 — all with the new format. Not fixable on the site side (the placeholder is built inside the worker).

Ask

Document the format as part of the ?renderJson contract (the shape is implementation-defined: the app should treat lazyUrl as opaque and fetch it relative to the origin), or — if any consumer is known to depend on /deco/render?format=json— offer a compat option emitting that form (TanStack has no resolveChain, so it would carry href + __section under the /deco/render path instead).

Found while validating deco-sites/oficina-tanstack#479.

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions