@cosmicdrift/kumiko-renderer 0.155.0 → 0.155.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.
- package/package.json +5 -4
- package/src/format-when.ts +7 -2
- package/src/hooks/use-ai-text.ts +1 -0
- package/src/hooks/use-query.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer",
|
|
3
|
-
"version": "0.155.
|
|
3
|
+
"version": "0.155.1",
|
|
4
4
|
"description": "Platform-agnostic React renderer for Kumiko screens. Contains the shared logic — primitives-contract, hooks, KumikoScreen, navigation & SSE abstractions — that any platform-specific renderer (web, native) composes. No DOM, no EventSource, no react-dom.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cosmicdrift/kumiko-framework": "0.155.
|
|
19
|
-
"@cosmicdrift/kumiko-headless": "0.155.
|
|
20
|
-
"react": "^19.2.6"
|
|
18
|
+
"@cosmicdrift/kumiko-framework": "0.155.1",
|
|
19
|
+
"@cosmicdrift/kumiko-headless": "0.155.1",
|
|
20
|
+
"react": "^19.2.6",
|
|
21
|
+
"temporal-polyfill": "^0.3.2"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@testing-library/react": "^16.3.2",
|
package/src/format-when.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { Temporal } from "temporal-polyfill";
|
|
2
|
+
|
|
1
3
|
// Shared timestamp formatter for operator screens (audit log, job runs) —
|
|
2
4
|
// falls back to the raw ISO string on an unparseable value instead of "Invalid Date".
|
|
3
5
|
export function formatWhen(value: string): string {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
try {
|
|
7
|
+
return Temporal.Instant.from(value).toLocaleString();
|
|
8
|
+
} catch {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
6
11
|
}
|
package/src/hooks/use-ai-text.ts
CHANGED
package/src/hooks/use-query.ts
CHANGED
|
@@ -87,14 +87,14 @@ export function useQuery<TData = unknown>(
|
|
|
87
87
|
|
|
88
88
|
setLoading(true);
|
|
89
89
|
const result = await dispatcher.query<TData>(type, payload, { signal: ctrl.signal });
|
|
90
|
-
//
|
|
90
|
+
// skip: a newer fetch already superseded this one, don't clobber its state
|
|
91
91
|
if (ctrl.signal.aborted) return;
|
|
92
92
|
if (result.isSuccess) {
|
|
93
93
|
setData(result.data);
|
|
94
94
|
setError(null);
|
|
95
95
|
} else {
|
|
96
96
|
// A cancelled request comes back with code "aborted" from the
|
|
97
|
-
//
|
|
97
|
+
// skip: aborted request, a newer run already replaces this result
|
|
98
98
|
if (result.error.code === "aborted") return;
|
|
99
99
|
setError(result.error);
|
|
100
100
|
}
|
|
@@ -104,6 +104,7 @@ export function useQuery<TData = unknown>(
|
|
|
104
104
|
useEffect(() => {
|
|
105
105
|
if (!enabled) {
|
|
106
106
|
setLoading(false);
|
|
107
|
+
// skip: query disabled, loading state already cleared above
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
110
|
void run();
|
|
@@ -117,8 +118,10 @@ export function useQuery<TData = unknown>(
|
|
|
117
118
|
// Subscription-Lifecycle genau einmal durchwalzt.
|
|
118
119
|
const subscribeLive = useLiveEvents();
|
|
119
120
|
useEffect(() => {
|
|
121
|
+
// skip: live mode or query disabled, no SSE subscription needed
|
|
120
122
|
if (!live || !enabled) return;
|
|
121
123
|
const entity = entityFromQueryType(type);
|
|
124
|
+
// skip: query type has no mapped entity, nothing to subscribe to
|
|
122
125
|
if (entity === undefined) return;
|
|
123
126
|
return subscribeLive(entity, () => {
|
|
124
127
|
void run();
|