feat(ui,ui-server)!: remove Suspense — loading UX is early-return + query.loading [#2985]#2990
Merged
viniciusdacal merged 3 commits intomainfrom Apr 23, 2026
Merged
feat(ui,ui-server)!: remove Suspense — loading UX is early-return + query.loading [#2985]#2990viniciusdacal merged 3 commits intomainfrom
viniciusdacal merged 3 commits intomainfrom
Conversation
…uery.loading [#2985] Closes #2985. Suspense is rejected as a Vertz primitive. The signal/reactivity model already handles loading states via `query().loading` plus the compiler-supported early-return guard pattern (`if (q.loading) return <Loading/>; return <Real/>`), which also keeps `q.data` typed-defined past the guard so APIs like `form(..., { initial: () => q.data })` work without null checks. The Promise- throwing Suspense machinery that mirrored React added no capability that Vertz didn't already have, and coupled user-facing code to a runtime contract the compiler doesn't model. Removed - packages/ui: `Suspense` component, `SuspenseProps` type, and the internal `error-boundary-context` module (async-error handler stack used only by Suspense). `ErrorBoundary` keeps its synchronous try/catch + retry behavior; redundant async-path tests are gone. - packages/ui-server: `SuspenseVNode` / `__suspense` tag and its deferred resolution loop in `renderToStream`. `renderToStream(tree, options?)` is now `renderToStream(tree)` — walks the tree synchronously and emits a single HTML chunk. `createSlotPlaceholder`, `resetSlotCounter`, `createTemplateChunk`, and `RenderToStreamOptions` are removed along with their tests. Nothing in shipped code produced `__suspense` VNodes. - Docs: `@vertz/ui` README / api-cheat-sheet, `@vertz/ui-server` README, and `docs/guides/ssr-hydration.md` no longer mention Suspense. A new section ("Early return when you need loaded data") in `mint-docs/guides/ui/data-fetching.mdx` documents the replacement pattern. Public API changes - Breaking: `Suspense`, `SuspenseProps` removed from `@vertz/ui`. - Breaking: `createSlotPlaceholder`, `resetSlotCounter`, `createTemplateChunk`, `RenderToStreamOptions` removed from `@vertz/ui-server`. - Breaking: `renderToStream` no longer accepts an options argument. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ion [#2985] Review follow-up: the Options bullet under `renderToStream(tree)` referenced the removed `nonce?: string` field, and the "CSP Nonce Support" section showed `renderToStream(tree, { nonce })` which is no longer a valid call signature after Suspense removal dropped `RenderToStreamOptions`. Both blocks are gone. Other nonce-aware APIs (ssr-progressive-response, ssr-access-set, template-inject) are unaffected and retain their nonce parameters. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Closes #2985.
query().loadingplus compiler-supported early-return guards (if (q.loading) return <Loading/>; return <Real/>) — which also keepsq.datatyped-defined past the guard so APIs likeform(..., { initial: () => q.data })work without null checks.Suspensecomponent existed in@vertz/uibut had no JSX-compatible children contract (children: () => JsxElementvs how the compiler wraps children). It was never used as JSX anywhere in the repo and never documented in mint-docs. The parallel__suspenseVNode streaming protocol in@vertz/ui-server(SuspenseVNode,createSlotPlaceholder,createTemplateChunk) was dead code — nothing in shipped code produced__suspensenodes. Both are gone.mint-docs/guides/ui/data-fetching.mdxdocumenting the replacement pattern with a form-on-loaded-data example and the flat-guard constraint.Public API Changes
Breaking removals from
@vertz/ui:SuspensecomponentSuspensePropstypeBreaking removals from
@vertz/ui-server:createSlotPlaceholderresetSlotCountercreateTemplateChunkRenderToStreamOptions(and thenonceoption onrenderToStream)renderToStream(tree, options?)is nowrenderToStream(tree)— fully synchronous, single HTML chunk.Internal cleanup:
error-boundary-context.ts(thepushErrorHandler/popErrorHandler/getCurrentErrorHandlerstack used only by Suspense) removed.ErrorBoundarykeeps its synchronous try/catch + retry unchanged.Commits
057b1607a— main removal8528eee17— adversarial-review follow-up: drop stalenonceOptions block + CSP Nonce Support section from@vertz/ui-serverREADME87329972a— oxfmt fixAdversarial Review
reviews/remove-suspense/phase-01-removal.md— one BLOCKER found (stale README docs), fixed in8528eee17.Test plan
vtz teston@vertz/ui— 2461 passedvtz teston@vertz/ui-server— 1270 passed / 60 skipped / 15 todotsgo --noEmiton both packages — cleanoxlint— 0 errorsoxfmt --check— cleancargo test --all— 47 passedcargo clippy --all-targets -- -D warnings— cleancargo fmt --all -- --check— cleanbun run ci:build-typecheck:affected— 40/40 passSuspense/__suspense/SuspenseVNode/SuspenseProps/createSlotPlaceholder/resetSlotCounter/createTemplateChunk/slot-placeholder/template-chunk/error-boundary-context/RenderToStreamOptionsreferences outside CHANGELOGs, plans/, and the changeset file itself.🤖 Generated with Claude Code