Skip to content

Commit 8b0ab9e

Browse files
Merge branch 'main' into renovate/actions-checkout-7.x
2 parents d6a0c29 + 5c374e2 commit 8b0ab9e

3 files changed

Lines changed: 38 additions & 2 deletions

File tree

src/routes/solid-start/v2/(1)advanced/(4)serialization.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,38 @@ export default defineConfig({
4141

4242
If your app enforces a Content Security Policy, keep `json`.
4343

44+
## Temporal values
45+
46+
SolidStart preserves JavaScript [`Temporal`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal) values in server function and action payloads. The value is reconstructed as the same Temporal type on the receiving side.
47+
48+
SolidStart does not install a Temporal implementation. Native server-runtime availability is:
49+
50+
| Runtime | Unflagged global `Temporal` support |
51+
| ------- | ---------------------------------------------------------------- |
52+
| Node.js | [26 and later](https://nodejs.org/en/blog/release/v26.0.0/) |
53+
| Deno | [2.7 and later](https://deno.com/blog/v2.7) |
54+
| Bun | [No stable release](https://github.com/oven-sh/bun/issues/15853) |
55+
56+
Server-runtime support does not guarantee browser support. Both the client and server must provide a compatible global `Temporal` before a payload is serialized or deserialized. Check `typeof globalThis.Temporal !== "undefined"` in each target environment.
57+
58+
If any runtime targeted by your app does not provide `Temporal` natively, install a global polyfill:
59+
60+
```sh
61+
pnpm add temporal-polyfill
62+
```
63+
64+
```ts title="src/temporal.ts"
65+
import "temporal-polyfill/global";
66+
```
67+
68+
Import the shared module before application initialization in both entrypoints:
69+
70+
```tsx title="src/entry-client.tsx and src/entry-server.tsx"
71+
import "./temporal";
72+
```
73+
74+
Use the polyfill's global entrypoint. A local import such as `import { Temporal } from "temporal-polyfill"` does not define the global that serialization requires. Without a compatible global on either side, sending a Temporal value causes serialization or deserialization to fail.
75+
4476
## Custom types
4577

4678
Use a custom Seroval plugin when a server function needs to accept or return a value that Seroval does not support, such as a database identifier, decimal type, or another custom class.

src/routes/solid-start/v2/(2)migrating-from-v1.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Audit those dependencies before shipping a production upgrade.
2424
### Update dependencies
2525

2626
```package-install
27-
@solidjs/start@2.0.0-rc.5 nitro@3 vite@8
27+
@solidjs/start@2.0.0-rc.7 nitro@3 vite@8
2828
```
2929

3030
```package-remove

src/routes/solid-start/v2/reference/config/solid-start.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ Controls server-function argument and result serialization. `json` avoids `eval`
108108

109109
The `plugins` option points to a module containing custom Seroval plugins for values that Seroval does not support by default.
110110

111+
Built-in serialization of `Temporal` values requires a compatible global `Temporal` implementation on both the client and server. SolidStart does not install a polyfill.
112+
111113
See [Serialization](/solid-start/v2/advanced/serialization).
112114

113115
### `solid`
@@ -139,7 +141,9 @@ solidStart({
139141

140142
Path to a module whose default export handles values thrown by server functions before SolidStart serializes them into a response.
141143

142-
The handler can report the original value and return a safer replacement for the client. Return `undefined` to preserve the original value. The module is bundled only into the server, so it can import server-only code.
144+
The handler can report the original value and provide a safer replacement for the client. SolidStart awaits the handler before serializing the response, allowing a monitoring service to flush first.
145+
146+
Returning or resolving to `undefined` or `null` preserves the original value. A `Response` preserves control flow, while any other value replaces the original. The module is bundled only into the server, so it can import server-only code.
143147

144148
```tsx title="vite.config.ts"
145149
solidStart({

0 commit comments

Comments
 (0)