@cosmicdrift/kumiko-renderer 0.261.0 → 0.262.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/package.json +4 -4
- package/src/app/kumiko-screen.tsx +17 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.262.0",
|
|
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,8 +15,8 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
19
|
-
"@cosmicdrift/kumiko-headless": "0.
|
|
18
|
+
"@cosmicdrift/kumiko-framework": "0.262.0",
|
|
19
|
+
"@cosmicdrift/kumiko-headless": "0.262.0",
|
|
20
20
|
"react": "^19.2.6",
|
|
21
21
|
"temporal-polyfill": "^0.3.2",
|
|
22
22
|
"zod": "^4.4.3"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@types/react-dom": "^19.2.3",
|
|
28
28
|
"jsdom": "^29.1.1",
|
|
29
29
|
"react-dom": "^19.2.6",
|
|
30
|
-
"@cosmicdrift/kumiko-locale-de": "0.
|
|
30
|
+
"@cosmicdrift/kumiko-locale-de": "0.262.0"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
@@ -33,7 +33,11 @@ import type {
|
|
|
33
33
|
import { fieldLabelKey, fieldOptionLabelKey, isSafeHref } from "@cosmicdrift/kumiko-headless";
|
|
34
34
|
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
35
35
|
import { extractCreatedId, extractIdField } from "../components/reference-create-dialog";
|
|
36
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
RenderEdit,
|
|
38
|
+
type RenderEditAction,
|
|
39
|
+
type RenderEditControls,
|
|
40
|
+
} from "../components/render-edit";
|
|
37
41
|
import {
|
|
38
42
|
needsActionConfirm,
|
|
39
43
|
RenderEditActionButton,
|
|
@@ -701,6 +705,13 @@ function EntityEditCreateBody({
|
|
|
701
705
|
const formSchema = useMemo(() => buildFormSchema(entity, screen), [entity, screen]);
|
|
702
706
|
const writeCommand = entityWriteCommand(schema.featureName, screen.entity, "create");
|
|
703
707
|
const navigateToList = useNavigateToListAfter(schema, screen.entity);
|
|
708
|
+
// Create's write-handler success payload doesn't flatly expose a parent FK
|
|
709
|
+
// (`{ kind, id, data, … }`), so an object-form redirect's `idFrom` falls
|
|
710
|
+
// back to the values just submitted to the handler.
|
|
711
|
+
const controlsRef = useRef<RenderEditControls<FormValues> | null>(null);
|
|
712
|
+
const handleControlsReady = useCallback((controls: RenderEditControls<FormValues>) => {
|
|
713
|
+
controlsRef.current = controls;
|
|
714
|
+
}, []);
|
|
704
715
|
const handleSubmitted = useCallback(
|
|
705
716
|
(result: SubmitResult<unknown>) => {
|
|
706
717
|
if (!result.isSuccess) return;
|
|
@@ -722,6 +733,7 @@ function EntityEditCreateBody({
|
|
|
722
733
|
result.data,
|
|
723
734
|
schema,
|
|
724
735
|
appFeatures,
|
|
736
|
+
controlsRef.current?.getValues(),
|
|
725
737
|
);
|
|
726
738
|
nav.navigate({ screenId, ...(entityId !== undefined && { entityId }) });
|
|
727
739
|
return;
|
|
@@ -744,6 +756,7 @@ function EntityEditCreateBody({
|
|
|
744
756
|
schema={formSchema}
|
|
745
757
|
writeCommand={writeCommand}
|
|
746
758
|
onSubmit={handleSubmitted}
|
|
759
|
+
onControlsReady={handleControlsReady}
|
|
747
760
|
onCancel={navigateToList}
|
|
748
761
|
{...(screen.submitLabel !== undefined && { submitLabel: screen.submitLabel })}
|
|
749
762
|
{...(translate !== undefined && { translate })}
|
|
@@ -2959,8 +2972,9 @@ function redirectScreenTarget(
|
|
|
2959
2972
|
// list screen never gets an id attached, matching actionForm's original
|
|
2960
2973
|
// behavior. The id itself prefers the write-handler's success payload
|
|
2961
2974
|
// (`submittedData`) and falls back to `fallbackRecord` — the entityEdit
|
|
2962
|
-
// update path's already-loaded record,
|
|
2963
|
-
//
|
|
2975
|
+
// update path's already-loaded record, or the create path's just-submitted
|
|
2976
|
+
// form values — both of which carry fields (e.g. a parent FK) the CRUD
|
|
2977
|
+
// write executor's success payload doesn't flatly expose.
|
|
2964
2978
|
function resolveRedirectTarget(
|
|
2965
2979
|
redirect: string | ActionFormRedirect,
|
|
2966
2980
|
submittedData: unknown,
|