Repository navigation
fix(tanstack): compose meta.gen.json on dev/sandbox schema regen - #493
Merged
Merged
Conversation
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]>
|
🎉 This PR is included in version 7.48.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Problem
The vite plugin's
meta.gen.jsonauto-regeneration runsgenerate-schema.tswithout--composeat both invocation sites:plugin.js— watch-driven regen (fires on anysrc/**/*.ts(x)add/change)plugin.js— cold-start bootstrap (when the file is absent)generate-schema.tsdefaultsCOMPOSE = false, and its own header notes that without--composethe output "omits Page, matchers,__SECTION_REF__, Resolvable thatcomposeMetaotherwise [injects]". So every regen writes an uncomposed manifest missing every frameworkwebsite/*block.meta.gen.jsonis committed, and Studio reads it as-is (nocomposeMetaat 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.tsdisappears, 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-tanstackwhose 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 mirrorsnpm run generate's schema step (blocks-cli generate --compose) and the production build, which already compose.No other flags are needed:
generate-schemadefaults--sections src/sections,--loaders src/loaders,--apps src/apps, out.deco/meta.gen.json— exactly what sites pass.composeMetais dynamically imported from@decocms/blocks, which is installed in the sandbox.Test
generateSchemaArgsunit test asserts--composeis always present and the site is targeted. The invocations themselves live in theconfigureServerclosure (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 typecheckandvitest(12 passed) green; no new Biome diagnostics.Note
This is the generation-side root fix. The daemon committing a generated
meta.gen.jsonis 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.tswithout--compose; now both watch and cold-start invocations always include--composevia a shared helper.generateSchemaArgs(site)and routes both invocations through it, pinning--compose.npm run generateand production behavior (@decocms/blocks-cliwith--compose).--composeis present and the target site is set.Written for commit b33d2bb. Summary will update on new commits.