@sigrea/react 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/README.md +42 -2
  2. package/package.json +4 -3
package/README.md CHANGED
@@ -20,6 +20,7 @@
20
20
  - [useDeepSignal](#usedeepsignal)
21
21
  - [useMolcule](#usemolcule)
22
22
  - [Testing](#testing)
23
+ - [Handling Scope Cleanup Errors](#handling-scope-cleanup-errors)
23
24
  - [Development](#development)
24
25
  - [License](#license)
25
26
 
@@ -68,7 +69,7 @@ const CounterMolecule = molecule((props: { initialCount: number }) => {
68
69
  });
69
70
 
70
71
  export function Counter(props: { initialCount: number }) {
71
- const counter = useMolcule(CounterMolcule, props);
72
+ const counter = useMolcule(CounterMolecule, props);
72
73
  const value = useSignal(counter.count);
73
74
 
74
75
  return (
@@ -160,15 +161,54 @@ it("increments and displays the updated count", () => {
160
161
  });
161
162
  ```
162
163
 
164
+ ## Handling Scope Cleanup Errors
165
+
166
+ For global error handling configuration, see [@sigrea/core - Handling Scope Cleanup Errors](https://github.com/sigrea/core#handling-scope-cleanup-errors).
167
+
168
+ In React apps, configure the handler in your application entry point before rendering:
169
+
170
+ ```tsx
171
+ // index.tsx or main.tsx
172
+ import { setScopeCleanupErrorHandler } from "@sigrea/core";
173
+ import { createRoot } from "react-dom/client";
174
+ import { App } from "./App";
175
+
176
+ setScopeCleanupErrorHandler((error, context) => {
177
+ console.error(`Cleanup failed:`, error);
178
+
179
+ // Forward to monitoring service
180
+ if (typeof Sentry !== "undefined") {
181
+ Sentry.captureException(error, {
182
+ tags: { scopeId: context.scopeId, phase: context.phase },
183
+ });
184
+ }
185
+ });
186
+
187
+ createRoot(document.getElementById("root")!).render(<App />);
188
+ ```
189
+
163
190
  ## Development
164
191
 
165
- Development scripts prefer pnpm. npm or yarn work too, but pnpm keeps dependency resolution identical to CI.
192
+ This repo targets Node.js 20 or later.
193
+
194
+ If you use mise:
195
+
196
+ - `mise trust -y` — trust `mise.toml` (first run only).
197
+ - `mise run ci` — run CI-equivalent checks locally.
198
+ - `mise run notes` — preview release notes (optional).
199
+
200
+ You can also run pnpm scripts directly:
166
201
 
167
202
  - `pnpm install` — install dependencies.
168
203
  - `pnpm test` — run the Vitest suite once (no watch).
204
+ - `pnpm typecheck` — run TypeScript type checking.
205
+ - `pnpm test:coverage` — collect coverage.
169
206
  - `pnpm build` — compile via unbuild to produce dual CJS/ESM bundles.
207
+ - `pnpm cicheck` — run CI checks locally.
170
208
  - `pnpm dev` — launch the playground counter demo.
171
209
 
210
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for workflow details.
211
+
172
212
  ## License
173
213
 
174
214
  MIT — see [LICENSE](./LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigrea/react",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "React adapter bindings for Sigrea molecule modules.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -49,10 +49,11 @@
49
49
  "test:coverage": "vitest --coverage",
50
50
  "typecheck": "tsc -p tsconfig.json --noEmit",
51
51
  "format": "biome check .",
52
- "format:fix": "biome check --write ."
52
+ "format:fix": "biome check --write .",
53
+ "cicheck": "pnpm test && pnpm typecheck && pnpm format:fix"
53
54
  },
54
55
  "peerDependencies": {
55
- "@sigrea/core": "^0.4.0",
56
+ "@sigrea/core": "^0.4.3",
56
57
  "react": "^18.0.0 || ^19.0.0",
57
58
  "react-dom": "^18.0.0 || ^19.0.0"
58
59
  },