Skip to content

fix(tanstack): compose meta.gen.json on dev/sandbox schema regen - #493

Merged
guitavano merged 1 commit into
mainfrom
fix/tanstack-compose-meta
Aug 20, 2026
Merged

guitavano merged 1 commit into
mainfrom
fix/tanstack-compose-meta

Conversation

@guitavano

@guitavano guitavano commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The vite plugin's meta.gen.json auto-regeneration runs generate-schema.ts without --compose at both invocation sites:

  • plugin.js — watch-driven regen (fires on any src/**/*.ts(x) add/change)
  • plugin.js — cold-start bootstrap (when the file is absent)

generate-schema.ts defaults COMPOSE = false, and its own header notes that without --compose the output "omits Page, matchers, __SECTION_REF__, Resolvable that composeMeta otherwise [injects]". So every regen writes an uncomposed manifest missing every framework website/* block.

meta.gen.json is committed, and Studio reads it as-is (no composeMeta at read time). In a sandbox session the plugin rewrites it uncomposed, and the daemon's shutdown "sync all local changes" commits it — clobbering the composed manifest on the branch. The admin editors then break silently. Most visibly, website/matchers/date.ts disappears, so the variant-rule editor ("Regra de variante") loses its start/end date fields.

Reported on casaevideo-tanstack ("o campo com as datas sumiu de novo"); a lebiscuit-tanstack whose committed manifest was still composed was unaffected. This recurred repeatedly (casaevideo #494, #566, #633) — each time a hotfix restored the composed file, but the plugin re-clobbered it on the next session.

Fix

Route both invocations through a new exported generateSchemaArgs(siteName) helper that pins --compose, so the flag can't drift off one site. This mirrors npm run generate's schema step (blocks-cli generate --compose) and the production build, which already compose.

No other flags are needed: generate-schema defaults --sections src/sections, --loaders src/loaders, --apps src/apps, out .deco/meta.gen.json — exactly what sites pass. composeMeta is dynamically imported from @decocms/blocks, which is installed in the sandbox.

Test

generateSchemaArgs unit test asserts --compose is always present and the site is targeted. The invocations themselves live in the configureServer closure (needs a live vite server to exercise), so the helper is the unit boundary both sites derive their args from — the flag can't silently drop off one again.

npm run typecheck and vitest (12 passed) green; no new Biome diagnostics.

Note

This is the generation-side root fix. The daemon committing a generated meta.gen.json is by design (it's committed for cold-start, and a vibecode agent may legitimately change an interface and regenerate it) — the defect was purely that the sandbox regen produced a degraded manifest.

🤖 Generated with Claude Code


Summary by cubic

Composes meta.gen.json during dev/sandbox schema regeneration to stop committing an uncomposed manifest that removes framework website/* blocks and breaks admin editors. Previously the Vite plugin ran generate-schema.ts without --compose; now both watch and cold-start invocations always include --compose via a shared helper.

  • Centralizes args in generateSchemaArgs(site) and routes both invocations through it, pinning --compose.
  • Matches npm run generate and production behavior (@decocms/blocks-cli with --compose).
  • Adds unit tests that assert --compose is present and the target site is set.
  • No migration required; committed meta.gen.json remains composed and features like the date matcher in the variant rule editor persist.

Written for commit b33d2bb. Summary will update on new commits.

Review in cubic

The vite plugin's meta.gen.json auto-regeneration ran generate-schema.ts
with `--site <site>` but WITHOUT `--compose`, at both invocation sites
(watch-driven regen on src/**/*.ts(x) changes and the cold-start
bootstrap). generate-schema defaults COMPOSE=false, so the output was an
UNCOMPOSED manifest missing every framework website/* block — matchers,
Page, __SECTION_REF__, Resolvable.

meta.gen.json is committed and Studio reads it as-is (there is no
composeMeta at read time), so once the sandbox daemon's shutdown sync
committed the regenerated file, the admin editors silently broke. Most
visibly: the date matcher (website/matchers/date.ts) vanished, so the
"Regra de variante" editor lost its start/end date fields
(casaevideo-tanstack #633 — "o campo com as datas sumiu de novo").

Route both invocations through a new generateSchemaArgs() helper that
pins `--compose`, so the flag can never drift off one site. This matches
`npm run generate`'s schema step (blocks-cli generate --compose).

Test: generateSchemaArgs always includes --compose (the invocations
themselves live in the configureServer closure, which needs a live vite
server; the helper is the unit boundary the closure derives its args
from).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@guitavano
guitavano requested a review from a team August 20, 2026 13:54
@guitavano
guitavano merged commit ad799d9 into main Aug 20, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 7.48.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant