Repository navigation
feat(core, ui-react)!: block renderers move out of blockTypes into the createRoutes renderers module (R2) - #31
Merged
Conversation
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 59 minutes. View limit details
TanStack is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.
|
🦋 Changeset detectedLatest commit: b5a0594 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 |
This was referenced Nov 6, 2026
Merged
cursor
Bot
force-pushed
the
cursor/renderer-binding-d21e
branch
from
November 6, 2026 14:50
b29bfb8 to
a50f376
Compare
jherr
force-pushed
the
cursor/renderer-binding-d21e
branch
from
November 6, 2026 15:06
a50f376 to
b5a0594
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 § Track R2 for block renderers: item 9 ("Agnostic data model, framework-specific renderers"), item 10's props-over-providers rule, and decided questions 21 and 22. Field inputs follow in a separate PR stacked on this one, as Q22 asks.
Merge chain: step 7 of 24. Base:
main. Merge it right after #28. The branch ismain3b4a112, then one commit for each PR before this one in the merge order, then this PR's own commita50f376(tree2647b7e).What
Block types are data only in
@tanstack/cms-core:BlockTypeis{ type, label, fields }.defineBlock,defineCmsand pluginblockTypesthrow for a block type that still has acomponent, and the error names the fix.A renderers module (Q21):
defineRenderers({ blocks })comes from@tanstack/cms-ui-react.createRoutes(definition, { renderers: '../cms.renderers.tsx' }). That's a path, never an import, sovite.config.tsstays React-free.tanstackCms()plugin'sloadhook serves the package'ssrc/app-renderers.tsas that module, and every package route imports it.Resolution order in
BlockView:renderersprop;GenericBlockView.Lookups are own-property only.
Bespoke code passes renderers as props.
BlocksView,BlockView,InteractivePageContentandInteractiveDocumenttakerenderers.Apps:
starters/themed-smb-siterendersserviceCalloutfromsrc/cms.renderers.tsx, passed as a prop.examples/blogadds aquoteblock rendered through the module path, with an E2E test that covers both server render and client navigation.Docs and skills. The blocks-and-rendering guide, the
cms-ui-reactandcms-corereferences, the route spec tables, the migration docs and the four migration skills are updated. The upgrade guide gains §22.Changeset:
block-renderers-module.md, minor and breaking in pre-mode, forcms-coreandcms-ui-react.Breaking changes
BlockType.componentis removed, and passing one throws. To migrate, move the component into a renderers module:Then name the module in
createRoutes, or passrendererstoBlocksViewin your own routes. There's no codemod; upgrading §22 shows before and after.Assumptions (tasks 8–12 defaults)
rootFile. The export is namedrenderers.renderBlocksToHtml,renderBlockToHtml) stay where they are.Divergence from plan
loadhook overrides, not a virtual import. A bare virtual import failsnoUncheckedSideEffectImports, and a real file keeps customrootFiles working.How verified
CI is down because GitHub Actions is out of billing, so this was run locally. I rebased #25, #28, R2 blocks and R2 fields onto #24's main-based head
2850c54, which is the state after batch 3 merges.pnpm test:ci: passes except thecms-api:test:oxlintfailure thatmainalready has.test:dts: clean.test:dialects: passes.test:scripts: 93/93.test:definitions: 26/26.The worker also ran
test:pr, the ui-react (105) and core unit tests, andpack-consumer, which fails only on theformsLeadCaptureSkillerror thatmainalready has.The built blog server, run with
node .output/server/index.mjs, returned 500 with "Cannot read properties of null (reading 'useRef')". That wasn't a regression:main(3b4a112) and108e342, from before the refactor, fail the same way. #44 fixes it and merges before this PR, and every chain tip from step 2 on passes the SSR smoke test.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.
Two files conflicted,
vite.tsandvirtual-routes.ts:loadserves fix(ui-react): one React in the production SSR bundle under pnpm #44's shims, then theapp-renderersbinding, and returnsundefinedfor any other id.toBeNull()assertions becometoBeUndefined().In
cms-ui-react.md,CmsVitePlugingainsresolveId, and the prose gains #44's SSR sentence.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.