Repository navigation
feat(ui-react)!: createRoutes(definition, spec) replaces cmsVirtualRoutes(options) - #28
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed. TanStack is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.
|
🦋 Changeset detectedLatest commit: ff8f9a6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cursor
Bot
force-pushed
the
cursor/definition-split-0c86
branch
from
November 6, 2026 02:57
b29aea0 to
d135174
Compare
cursor
Bot
force-pushed
the
cursor/create-routes-d21e
branch
from
November 6, 2026 03:00
14f88da to
70d506d
Compare
This was referenced Nov 6, 2026
Merged
cursor
Bot
force-pushed
the
cursor/definition-split-0c86
branch
from
November 6, 2026 14:50
d135174 to
ebd385b
Compare
cursor
Bot
force-pushed
the
cursor/create-routes-d21e
branch
from
November 6, 2026 14:50
70d506d to
5389063
Compare
jherr
force-pushed
the
cursor/create-routes-d21e
branch
from
November 6, 2026 15:06
5389063 to
ff8f9a6
Compare
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.
Implements cms-refactor-plan.md § Phase 1d (item 3, "createRoutes(cms, spec) replaces cmsVirtualRoutes(options)").
Merge chain: step 6 of 24. Base:
main. Merge it right after #25. The branch ismain3b4a112, then one commit for each PR before this one in the merge order, then this PR's own commit5389063(tree64c4428).What
createRoutes(definition, spec?)replacescmsVirtualRoutes.vite.config.tsimports only./src/cms.definition.definition.adminBasePath(), and plugin routes come fromdefinition.pluginRoutes(). Neither is repeated in the Vite config.Grammar per surface (
public,admin,api):true, or leaving the surface out, mounts the whole surface (see the divergence below).falsemounts none.['review']mounts only those keys.{ agent: false, edit: './x.tsx' }drops or replaces single keys.customreplaceschildren, androotFilestays top-level.Errors. An unknown key, a key from another surface, the full
defineCmsconfig, or any removed option throws. Each removed-option error names its replacement and the codemod.CmsRouteKeyis documented public API, with the existing key names kept as the stable names.Build options.
routesDirectoryandgeneratedDirectorymove totanstackCms({ … }).Seam for 3c.
cmsRouteMounts()is where collection-aware public mounts (3c(ii)) and the shadowing check will go. Neither is built.Codemod.
pnpm codemod create-routes, with fixtures.init,pack-consumer, the starter route specs, the skills and the docs prose were updated by hand. The upgrade guide gains §21.createRoutes(definition, { rootFile, public: false, custom }).payload-after's/adminandexisting-app's/cms-adminnow live only in the definition.Collection imports. The collection modules in PRM and picks now import
/definitioninstead of the core root. Vite's config loader loads them in plain Node, which can't load the root from workspace source.Dialect marker.
cmsVirtualRoutesis retired, going from 150 non-test uses to 0. The upgrade guide is exempt because it has to name the removed API.Changeset. Minor (breaking) for cms-ui-react and cms-cli, patch for cms-core, with the codemod command.
Breaking changes
cmsVirtualRoutes(options)becomescreateRoutes(definition, spec?), andCmsVirtualRoutesOptionsbecomesCreateRoutesSpec:include: { public: false }public: falseroutes: { post, agent }childrencustomadminBasePath,pluginsdefineCmsDefinitionroutesDirectory,generatedDirectorytanstackCms()optionsTo migrate, run
pnpm codemod create-routes <app>.Assumptions (tasks 8–12 defaults)
minorin pre-mode.routes, then pluginadminRoutes, thencustom../src/cms.definition, which holds for every app in the repo.createRoutesaccepts any object withadminBasePath()andpluginRoutes(), so it doesn't check thedefineCmsDefinitionbrand.Divergence from plan
A surface you leave out is mounted. The plan groups "absent" with
false, but its own PRM mapping{ public: false, custom }only works if a missingadminandapiare mounted. So onlyfalseunmounts. As a result, a new route key mounts in apps that don't name its surface; the docs say so.Plugin order.
routesDirectoryandgeneratedDirectoryreachcreateRoutesthrough a global slot thattanstackCms()sets, sotanstackCms()must be called beforecreateRoutes(). With custom directories, the wrong order throws instead of silently using the defaults.The 1b follow-up isn't done, because it isn't a contained change.
collections()returns names only.It would need core to keep the definition and expose a full-schema accessor. After that,
requireCollectionand two direct reads are the switch points.test:definitionsmissed the core-root imports in PRM and picks. It loads throughtsx, while Vite uses plain Node. A follow-up commit on this PR blocks the@tanstack/cms-coreroot in definitions.How verified
pnpm test:prpasses, including all 11 app builds, except thecms-apioxlint error thatmainalready has.test:dts,test:dialects,test:definitions(26 of 26),test:scripts(91), kiira (125) andtest:docspass.pack-consumerbuilds the consumer app withcreateRoutes(definition), then fails only on theformsLeadCaptureSkillerror thatmainalready has.Merge chain (local verification, CI down)
This PR's commits are squashed into one commit on the linear merge chain. That commit holds this PR's own changes, resolved against every PR before it, with the integration rehearsal's fixes for this PR applied. Six files conflicted:
vite.config.tsfiles now importcreateRoutes,tanstackCmsanddefinition.docs/architecture/routes-in-a-package.mdkeeps this PR's bullets plus fix(ui-react): one React in the production SSR bundle under pnpm #44's SSR sentence.Separately,
UI_ROUTES_DIRno longer uses the globalURL, because #44's happy-dom test replaces it.The chain tip's tree is exactly the integration rehearsal plus #46 (
c4e6d7c), and the tip passes the full local suite. I simulated merging every PR in order, with a merge commit or a fast-forward at each step, and every step is clean. A plain squash of the next PR would conflict, because the squash commit isn't an ancestor of the next branch. To squash instead, first rebase the branch's one commit onto the newmain; that rebase is always clean.