You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(next): evolve client surface + adopt it in next-runtime-snapshot
- Drop the experimental npm dist-tag (publishConfig); the package stays flagged
experimental in its description and docs only, matching the other packages.
- RpcProvider now renders children eagerly and exposes live connection state:
useRpc() returns the client or null, useRpcStatus() returns { status, error }
(subscribed to the client's connection:status / connection:error events).
- Apply @devframes/next/client to examples/next-runtime-snapshot: its connect
provider is now a thin adapter over the package (the host/handler adapter
stays N/A there since devframe owns the server via createCac). Wire the turbo
build edge and regenerate the client API snapshot.
Copy file name to clipboardExpand all lines: docs/helpers/next.md
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ outline: deep
5
5
# Next Helper
6
6
7
7
> [!WARNING]
8
-
> Experimental. `@devframes/next`is published under the `experimental` npm tag (`npm i @devframes/next@experimental`) while its API settles. Expect changes before a stable release.
8
+
> Experimental. `@devframes/next`'s API is still settling — expect changes before a stable release.
9
9
10
10
`@devframes/next` hosts devframes from a Next.js App Router app. Next runs on webpack/Turbopack rather than Vite, so it hosts through a route handler instead of the [Vite Bridge](./vite-bridge): the package serves each devframe's SPA and its `__connection.json` from a single `fetch` handler your catch-all route delegates to, reusing devframe's own [`serveStaticHandler`](/adapters/dev) for SPA fallback, content types, and path-traversal guarding.
`@devframes/next/client` connects to the RPC backend and provides the client to your component tree — the React counterpart to `@devframes/nuxt`'s `$rpc` plugin.
98
+
`@devframes/next/client` connects to the RPC backend and provides the client to your component tree — the React counterpart to `@devframes/nuxt`'s `$rpc` plugin. Children render immediately, so your shell and a connection indicator stay visible while the client connects.
99
99
100
100
```tsx [app/providers.tsx]
101
101
'use client'
@@ -106,17 +106,22 @@ export function Providers({ children }: { children: React.ReactNode }) {
106
106
}
107
107
```
108
108
109
+
`useRpc()` returns the connected `DevframeRpcClient`, or `null` while connecting; scope it to your tool's namespace. `useRpcStatus()` returns the live `{ status, error }` for a connection indicator.
`RpcProvider` renders its `fallback` (default `null`) until the client connects, so `useRpc()` always returns a live client. Theming and layout stay app-owned.
124
+
Both hooks throw outside a `<RpcProvider>`. Theming and layout stay app-owned.
0 commit comments