Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/routes/solid-start/v2/(1)advanced/(4)serialization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,38 @@ export default defineConfig({

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

## Temporal values

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.

SolidStart does not install a Temporal implementation. Native server-runtime availability is:

| Runtime | Unflagged global `Temporal` support |
| ------- | ---------------------------------------------------------------- |
| Node.js | [26 and later](https://nodejs.org/en/blog/release/v26.0.0/) |
| Deno | [2.7 and later](https://deno.com/blog/v2.7) |
| Bun | [No stable release](https://github.com/oven-sh/bun/issues/15853) |

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.

If any runtime targeted by your app does not provide `Temporal` natively, install a global polyfill:

```sh
pnpm add temporal-polyfill
```

```ts title="src/temporal.ts"
import "temporal-polyfill/global";
```

Import the shared module before application initialization in both entrypoints:

```tsx title="src/entry-client.tsx and src/entry-server.tsx"
import "./temporal";
```

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.

## Custom types

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.
Expand Down
2 changes: 1 addition & 1 deletion src/routes/solid-start/v2/(2)migrating-from-v1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Audit those dependencies before shipping a production upgrade.
### Update dependencies

```package-install
@solidjs/start@2.0.0-rc.5 nitro@3 vite@8
@solidjs/start@2.0.0-rc.7 nitro@3 vite@8
```

```package-remove
Expand Down
6 changes: 5 additions & 1 deletion src/routes/solid-start/v2/reference/config/solid-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ Controls server-function argument and result serialization. `json` avoids `eval`

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

Built-in serialization of `Temporal` values requires a compatible global `Temporal` implementation on both the client and server. SolidStart does not install a polyfill.

See [Serialization](/solid-start/v2/advanced/serialization).

### `solid`
Expand Down Expand Up @@ -139,7 +141,9 @@ solidStart({

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

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.
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.

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.

```tsx title="vite.config.ts"
solidStart({
Expand Down
Loading