@expressive/react 0.94.3 → 0.94.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressive/react",
|
|
3
|
-
"version": "0.94.
|
|
3
|
+
"version": "0.94.4",
|
|
4
4
|
"description": "Class-based reactive state for React. Define state and logic as plain classes; components update when the values they read change.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expressive",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"test": "bun run typecheck && bun run coverage"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@expressive/mvc": "^0.94.
|
|
67
|
+
"@expressive/mvc": "^0.94.4",
|
|
68
68
|
"@testing-library/react": "^16.3.0",
|
|
69
69
|
"@types/react": "^19",
|
|
70
70
|
"@types/react-dom": "^19",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vite": "^7.3.1"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@expressive/mvc": "^0.94.
|
|
79
|
+
"@expressive/mvc": "^0.94.4",
|
|
80
80
|
"react": ">=16.14.0 <20.0.0",
|
|
81
81
|
"vite": ">=5"
|
|
82
82
|
},
|
|
@@ -85,11 +85,18 @@ React can discard a render before committing it - a suspended first mount, a dro
|
|
|
85
85
|
|
|
86
86
|
## Server render (SSR / RSC)
|
|
87
87
|
|
|
88
|
-
Expressive components render on the server - `renderToString`, and the SSR pass of an RSC app (they are client components) - without touching the DOM. Nothing commits, so for a host-owned Component and the children it owns, effects declared in `new()` never run, `on({ ready })` never fires and `await state.get(() => {})`
|
|
88
|
+
Expressive components render on the server - `renderToString`, and the SSR pass of an RSC app (they are client components) - without touching the DOM. Nothing commits, so for a host-owned Component and the children it owns, effects declared in `new()` never run, `on({ ready })` never fires and `await state.get(() => {})` stays pending; the `new()` body does. Request-safety rules:
|
|
89
89
|
|
|
90
90
|
- **Request state goes in a `<Component for>`.** Each render builds its own context, so provided instances are isolated per request.
|
|
91
91
|
- **An instance held in `Context.root` is process-wide, *shared across requests* on the server** - fit for config, flags or a warmed cache. Keep per-request data out; provide it with `<Component for>`.
|
|
92
|
-
- **Resources belong in an effect or the request handler, never the `new()` body.** The body runs on the server but its
|
|
92
|
+
- **Resources belong in an effect or the request handler, never the `new()` body.** The body runs on the server, but nothing unmounts there - its teardown waits for the request to end, so a socket or handle opened there outlives the response. An effect is client-only; server-side resources are the framework's request scope to open and close.
|
|
93
|
+
- **End a request by popping its root's context.** It destroys every instance the host built beneath the root: teardowns run, children first, and a pending readiness await rejects `is destroyed.`. Without it they go at garbage collection. A root that is not a Component wraps in a bare `<Component is={…}>`:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
let app!: App;
|
|
97
|
+
const html = renderToString(<App is={(a) => void (app = a)} />);
|
|
98
|
+
Context.get(app)!.pop();
|
|
99
|
+
```
|
|
93
100
|
|
|
94
101
|
To render a specific request's data (a path, a session), provide it per request: `<Component for={Session} …>`. Each render's `Router` is its own, so paths never bleed between requests; provide `<Component for={Router} path={…}>` to render a request's path.
|
|
95
102
|
|