Skip to content

Rsc experiment#38

Open
Vijayabaskar56 wants to merge 17 commits intodevfrom
rsc-experiment
Open

Rsc experiment#38
Vijayabaskar56 wants to merge 17 commits intodevfrom
rsc-experiment

Conversation

@Vijayabaskar56
Copy link
Copy Markdown
Member

No description provided.

Add server-side custom domain resolution so forms can be served on
white-label domains (e.g. forms.acme.com/contact-us). Includes:
- resolveCustomDomain / loadFormForCustomDomain shared helpers
- /$slug route for slug-based lookups on custom domains
- /f/$formId route for UUID-based lookups on custom domains
- Host header check to distinguish app vs custom domain requests
- Automatic branding:false for custom domain forms
Required for React Server Components support introduced in
@tanstack/react-start@1.167+. Bumps router-plugin/generator/devtools-core
so the top-level router-core resolves to 1.168+ (RSC seroval adapter),
avoiding a silent version drift where the serializer couldn't handle
Composite Component RawStream payloads.
Flips rsc.enabled on the tanstackStart plugin and adds the
@vitejs/plugin-rsc entry. ssr.external and environments.rsc.resolve.external
cover the Node-only postgres / drizzle stack so server-fn modules never
leak pg into the client graph. @base-ui/react is excluded per the RSC
plugin's inconsistent-optimization warning.

Adds /rsc-test as a minimal Composite Component sanity route — server
renders a timestamp, a named slot is filled by a client counter. Lets
future RSC regressions be isolated to a 70-line file.

btca.config.jsonc: registers the TanStack router repo as a research
resource.
Moves the Plate static render path off the client for public form views.
Each step of the form is pre-rendered on the server as a Composite
Component; the client fills named Field / ButtonGroup slots with
interactive widgets. Result: @platejs/* no longer ships in the public
form bundle (keeps shipping in the editor path, which is unchanged).

- new getPublicFormViewRSC server fn — gates, per-step RSCs, thank-you RSC.
- new FormPreviewRSC client consumer — no platejs imports, reads the
  pre-baked Composite Components, owns TanStack Form state per step.
- PublicFormPage grows an optional rsc prop; $formId.tsx loader switches
  to the RSC server fn. $i8n.$formId.tsx keeps the legacy client-render
  path for now.
- public-form-view.ts: data fetcher extracted as a private helper
  (not exported — non-server-fn exports would teach the bundler to keep
  drizzle/pg in the client graph).

Also fixes the long-standing theme flash on public forms via
generateDualThemeCss: both light and dark tokens are emitted at SSR,
scoped by root html class. The pre-paint script selects one before paint,
no client-side regeneration.
The outer trigger was a <button> containing the per-tag "remove" <button>
children. Nested interactive elements are invalid HTML and surface as
React 19 hydration errors. Switch the trigger to a <div role="button">
with Enter/Space/Escape keyboard handlers and aria-haspopup/aria-expanded;
inner remove buttons stay as real <button>s.
The floating bubble was dropped during the scripts→embed TypeScript
modularization (commit 37582cd). Ported back into the new module layout:

- new lib/bubble.ts: reads popup.js script-tag data-* attrs, mounts a
  floating button immediately, upgrades icon/title once /api/forms/:id/meta
  resolves, delegates to the existing openPopup() on click with an onClose
  that restores bubble visibility.
- styles.ts: restores .bf-bubble rules (positions, default icon sizing,
  hidden state transitions).
- embed-popup.ts: init() now also calls setupAutoBubble(openPopup).
- iframe.ts / overlay.ts: clamp iframe + popup height to
  min(600, viewport - 40) so tall forms scroll inside the iframe's own
  page instead of overflowing the popup container with no scrollbar.
  Drops a dead if/else where both branches were identical.

Default icon is built inline via createElementNS to avoid a network
roundtrip for forms without a custom icon. Bubble renders synchronously;
the meta fetch upgrades it in the background instead of blocking mount.
After the TanStack dep bumps, two copies of @tanstack/query-core ended up
in the tree (top-level 5.99.0, nested 5.91.2), causing TS2345 on the
QueryClient parameter in _authenticated.tsx and router.tsx. Pin
react-query to 5.99.0 so its pinned query-core dep matches the
top-level copy.

Also fixes an unrelated Select onValueChange signature mismatch in
embed-config-panel.tsx — @base-ui's SelectRootChangeEventDetails now
passes value: string | null, not string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant