@shivaedev/react 0.30.1 → 0.31.0
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/CHANGELOG.md +13 -0
- package/README.md +6 -0
- package/dist/client/adapters/useBrowserErrors.d.ts +2 -0
- package/dist/client/adapters/useBrowserErrors.d.ts.map +1 -0
- package/dist/client/adapters/useBrowserErrors.js +32 -0
- package/dist/client/adapters/useBrowserErrors.js.map +1 -0
- package/package.json +8 -8
- package/src/client/adapters/useBrowserErrors.ts +32 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.31.0 - 2026-11-01
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Export Effect logs as trace events and ErrorReporter reports as error spans through the redacting Railway OTLP pipeline in appHost and worker Layers.
|
|
8
|
+
- Mount a same-origin browser error reporting route in appHost, with server redaction, bounded reports and per-client rate limiting.
|
|
9
|
+
- Generated starters enable Railway manual tracing for web and worker services and mount browser reporting by default.
|
|
10
|
+
- Add useBrowserErrors to forward uncaught browser errors and unhandled rejections to the host, removing listeners on unmount.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Mask complete RPC payload annotations before exporting logs and error reports, keeping sensitive error values out of Railway diagnostics even when the request uses public field names.
|
|
15
|
+
|
|
3
16
|
## 0.30.1 - 2026-10-31
|
|
4
17
|
|
|
5
18
|
### Changed
|
package/README.md
CHANGED
|
@@ -1012,3 +1012,9 @@ pnpm add @tanstack/react-router
|
|
|
1012
1012
|
The package needs Node 24 or newer.
|
|
1013
1013
|
- Query identity, TTL, invalidation and action concurrency remain native atom policies. Put the registry at the lifetime boundary those policies need.
|
|
1014
1014
|
- The package has no SSR registry/hydration adapter, offline write queue or optimistic reconciliation policy.
|
|
1015
|
+
|
|
1016
|
+
## Browser errors
|
|
1017
|
+
|
|
1018
|
+
Mount `useBrowserErrors` from `@shivaedev/react/client/adapters/useBrowserErrors.ts` once in the root component, outside the signed-in subtree. It forwards uncaught window errors and unhandled promise rejections to `appHost`'s `POST /_platform/errors` route, using the current page URL and available message and stack. Unmounting removes both listeners. Failed reporting requests are discarded. The starter mounts it by default.
|
|
1019
|
+
|
|
1020
|
+
The server rate-limits and redacts browser reports before sending them to Railway tracing alongside server errors and traces. Browser code receives no exporter credentials. See the [server guide](https://github.com/ShivaeDev/platform/blob/main/packages/server/README.md) for the route and local trace setup.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBrowserErrors.d.ts","sourceRoot":"","sources":["../../../src/client/adapters/useBrowserErrors.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,SA6B/B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
export function useBrowserErrors() {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
function send(kind, reason, message) {
|
|
5
|
+
const error = reason instanceof Error ? reason : undefined;
|
|
6
|
+
void fetch("/_platform/errors", {
|
|
7
|
+
body: JSON.stringify({
|
|
8
|
+
kind,
|
|
9
|
+
message: (error?.message ?? message ?? String(reason)).slice(0, 2048),
|
|
10
|
+
stack: error?.stack?.slice(0, 8192),
|
|
11
|
+
url: window.location.href.slice(0, 2048),
|
|
12
|
+
}),
|
|
13
|
+
headers: { "content-type": "application/json" },
|
|
14
|
+
keepalive: true,
|
|
15
|
+
method: "POST",
|
|
16
|
+
}).catch(() => undefined);
|
|
17
|
+
}
|
|
18
|
+
function onError(event) {
|
|
19
|
+
send("error", event.error, event.message);
|
|
20
|
+
}
|
|
21
|
+
function onRejection(event) {
|
|
22
|
+
send("unhandledrejection", event.reason);
|
|
23
|
+
}
|
|
24
|
+
window.addEventListener("error", onError);
|
|
25
|
+
window.addEventListener("unhandledrejection", onRejection);
|
|
26
|
+
return () => {
|
|
27
|
+
window.removeEventListener("error", onError);
|
|
28
|
+
window.removeEventListener("unhandledrejection", onRejection);
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=useBrowserErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBrowserErrors.js","sourceRoot":"","sources":["../../../src/client/adapters/useBrowserErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,UAAU,gBAAgB;IAC/B,SAAS,CAAC,GAAG,EAAE;QACd,SAAS,IAAI,CAAC,IAAoC,EAAE,MAAe,EAAE,OAAgB;YACpF,MAAM,KAAK,GAAG,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;YAC3D,KAAK,KAAK,CAAC,mBAAmB,EAAE;gBAC/B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACpB,IAAI;oBACJ,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;oBACrE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;oBACnC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;iBACxC,CAAC;gBACF,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,SAAS,EAAE,IAAI;gBACf,MAAM,EAAE,MAAM;aACd,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC3B,CAAC;QACD,SAAS,OAAO,CAAC,KAAiB;YACjC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,SAAS,WAAW,CAAC,KAA4B;YAChD,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;QACD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;QAC3D,OAAO,GAAG,EAAE;YACX,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7C,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;QAC/D,CAAC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;AACR,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "React query, action, editor and session hooks for native Effect atoms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"@effect/sql-pg": "4.0.6",
|
|
57
57
|
"@effect/sql-sqlite-node": "4.0.6",
|
|
58
58
|
"@shivaedev/changes": "0.6.0",
|
|
59
|
-
"@shivaedev/identity": "0.
|
|
60
|
-
"@shivaedev/jobs": "0.28.
|
|
61
|
-
"@shivaedev/quality": "0.
|
|
62
|
-
"@shivaedev/server": "0.
|
|
59
|
+
"@shivaedev/identity": "0.15.0",
|
|
60
|
+
"@shivaedev/jobs": "0.28.3",
|
|
61
|
+
"@shivaedev/quality": "0.53.0",
|
|
62
|
+
"@shivaedev/server": "0.16.0",
|
|
63
63
|
"@shivaedev/service": "0.6.0",
|
|
64
|
-
"@shivaedev/sql": "0.
|
|
65
|
-
"@shivaedev/test-sql": "0.15.
|
|
66
|
-
"@shivaedev/test-story": "0.31.
|
|
64
|
+
"@shivaedev/sql": "0.30.0",
|
|
65
|
+
"@shivaedev/test-sql": "0.15.3",
|
|
66
|
+
"@shivaedev/test-story": "0.31.3",
|
|
67
67
|
"@tanstack/react-router": "1.170.46",
|
|
68
68
|
"@types/node": "24.19.2",
|
|
69
69
|
"@types/react": "19.3.0",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
export function useBrowserErrors() {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
function send(kind: "error" | "unhandledrejection", reason: unknown, message?: string) {
|
|
6
|
+
const error = reason instanceof Error ? reason : undefined;
|
|
7
|
+
void fetch("/_platform/errors", {
|
|
8
|
+
body: JSON.stringify({
|
|
9
|
+
kind,
|
|
10
|
+
message: (error?.message ?? message ?? String(reason)).slice(0, 2048),
|
|
11
|
+
stack: error?.stack?.slice(0, 8192),
|
|
12
|
+
url: window.location.href.slice(0, 2048),
|
|
13
|
+
}),
|
|
14
|
+
headers: { "content-type": "application/json" },
|
|
15
|
+
keepalive: true,
|
|
16
|
+
method: "POST",
|
|
17
|
+
}).catch(() => undefined);
|
|
18
|
+
}
|
|
19
|
+
function onError(event: ErrorEvent) {
|
|
20
|
+
send("error", event.error, event.message);
|
|
21
|
+
}
|
|
22
|
+
function onRejection(event: PromiseRejectionEvent) {
|
|
23
|
+
send("unhandledrejection", event.reason);
|
|
24
|
+
}
|
|
25
|
+
window.addEventListener("error", onError);
|
|
26
|
+
window.addEventListener("unhandledrejection", onRejection);
|
|
27
|
+
return () => {
|
|
28
|
+
window.removeEventListener("error", onError);
|
|
29
|
+
window.removeEventListener("unhandledrejection", onRejection);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
}
|