@krak-stack/registry 0.11.1 → 0.11.2
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 +6 -0
- package/dist/components/agent/react.js +29 -183
- package/dist/components/animated-list/react.js +16 -168
- package/dist/components/animated-number/react.js +8 -162
- package/dist/components/async-action-button/react.js +10 -164
- package/dist/components/audit-log-table/react.js +59 -213
- package/dist/components/code-block/react.js +10 -164
- package/dist/components/copy-button/react.js +10 -164
- package/dist/components/copy-value/html.js +4 -4
- package/dist/components/copy-value/react.js +20 -172
- package/dist/components/danger-confirmation/react.js +13 -167
- package/dist/components/data-table/react.js +59 -213
- package/dist/components/editable-text/react.js +14 -168
- package/dist/components/email-composer/react.js +25 -174
- package/dist/components/email-editor/react.js +34 -186
- package/dist/components/error-component/react.js +15 -169
- package/dist/components/icon-input/react.js +7 -161
- package/dist/components/image-crop-editor/react.js +19 -173
- package/dist/components/markdown/react.js +10 -164
- package/dist/components/presence-transition/react.js +9 -163
- package/dist/components/registry-previews/component-example.js +10 -164
- package/dist/components/rich-text-editor/react.js +9 -161
- package/dist/components/search-menu/react.js +11 -165
- package/dist/components/sidebar-layout/react.js +3 -157
- package/dist/components/support/react.js +14 -168
- package/dist/components/timezone-input/react.js +9 -163
- package/dist/components/webhook-delivery-table/react.js +74 -226
- package/dist/lib/docs.integrations.server.js +16 -35
- package/dist/lib/docs.js +31 -183
- package/dist/lib/docs.server.js +16 -35
- package/dist/lib/documentation-toolkit.js +19 -38
- package/dist/lib/effect-ui-adapter/use-model.js +158 -0
- package/dist/services/agent/client/index.js +29 -183
- package/package.json +5 -1
|
@@ -1,165 +1,11 @@
|
|
|
1
1
|
// ../../src/components/animated-number/react.tsx
|
|
2
|
-
import { Component as Component2, View
|
|
2
|
+
import { Component as Component2, View } from "effect/ui";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
5
|
-
|
|
6
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
7
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
8
|
-
import {
|
|
9
|
-
createContext,
|
|
10
|
-
useCallback,
|
|
11
|
-
useContext,
|
|
12
|
-
useEffect,
|
|
13
|
-
useLayoutEffect,
|
|
14
|
-
useRef,
|
|
15
|
-
useState,
|
|
16
|
-
useSyncExternalStore
|
|
17
|
-
} from "react";
|
|
18
|
-
|
|
19
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
20
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
21
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
22
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
23
|
-
var node = () => ({ children: [] });
|
|
24
|
-
var modelHost = (commit) => {
|
|
25
|
-
const remove = (child) => {
|
|
26
|
-
if (!child.parent)
|
|
27
|
-
return;
|
|
28
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
29
|
-
delete child.parent;
|
|
30
|
-
};
|
|
31
|
-
return {
|
|
32
|
-
createElement: node,
|
|
33
|
-
createText: node,
|
|
34
|
-
setText: () => {},
|
|
35
|
-
setAttr: () => {},
|
|
36
|
-
setProp: () => {},
|
|
37
|
-
setEvents: () => {},
|
|
38
|
-
insertBefore: (parent, child, before) => {
|
|
39
|
-
if (child === before)
|
|
40
|
-
return;
|
|
41
|
-
remove(child);
|
|
42
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
43
|
-
parent.children.splice(index, 0, child);
|
|
44
|
-
child.parent = parent;
|
|
45
|
-
},
|
|
46
|
-
remove,
|
|
47
|
-
parentOf: (child) => child.parent,
|
|
48
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
49
|
-
elements: ["html"],
|
|
50
|
-
controlled: new Set,
|
|
51
|
-
runsMounts: false,
|
|
52
|
-
commit
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
56
|
-
let currentProps = props;
|
|
57
|
-
let root;
|
|
58
|
-
let active = true;
|
|
59
|
-
let failure;
|
|
60
|
-
const publish = () => {
|
|
61
|
-
if (!active)
|
|
62
|
-
return;
|
|
63
|
-
if (failure) {
|
|
64
|
-
publishSnapshot({ error: failure });
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const current = root?.model();
|
|
68
|
-
if (current !== undefined)
|
|
69
|
-
publishSnapshot({ model: current });
|
|
70
|
-
};
|
|
71
|
-
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
72
|
-
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
73
|
-
head: false,
|
|
74
|
-
onEmit,
|
|
75
|
-
fallback: ({ cause }) => {
|
|
76
|
-
failure = new Error("Effect UI root failed", {
|
|
77
|
-
cause: Cause.squash(cause)
|
|
78
|
-
});
|
|
79
|
-
return View.text("");
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
if (!active)
|
|
83
|
-
return;
|
|
84
|
-
root = mounted;
|
|
85
|
-
if (props !== currentProps)
|
|
86
|
-
mounted.setProps(currentProps);
|
|
87
|
-
publish();
|
|
88
|
-
return yield* Effect.never;
|
|
89
|
-
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
90
|
-
return {
|
|
91
|
-
send: (message) => {
|
|
92
|
-
root?.send(message);
|
|
93
|
-
publish();
|
|
94
|
-
},
|
|
95
|
-
setProps: (next) => {
|
|
96
|
-
currentProps = next;
|
|
97
|
-
root?.setProps(next);
|
|
98
|
-
},
|
|
99
|
-
dispose: () => {
|
|
100
|
-
active = false;
|
|
101
|
-
root = undefined;
|
|
102
|
-
Effect.runFork(Fiber.interrupt(fiber));
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
108
|
-
"use client";
|
|
109
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
110
|
-
var useModel = (component, props, options = {}) => {
|
|
111
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
112
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
113
|
-
const [store] = useState(() => {
|
|
114
|
-
const initial = { model: component.init(props).model };
|
|
115
|
-
let snapshot = initial;
|
|
116
|
-
const listeners = new Set;
|
|
117
|
-
return {
|
|
118
|
-
subscribe: (listener) => {
|
|
119
|
-
listeners.add(listener);
|
|
120
|
-
return () => {
|
|
121
|
-
listeners.delete(listener);
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
getSnapshot: () => snapshot,
|
|
125
|
-
getServerSnapshot: () => initial,
|
|
126
|
-
publish: (next) => {
|
|
127
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
128
|
-
return;
|
|
129
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
130
|
-
return;
|
|
131
|
-
snapshot = next;
|
|
132
|
-
listeners.forEach((listener) => listener());
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
137
|
-
const committed = useRef(props);
|
|
138
|
-
const onEmit = useRef(options.onEmit);
|
|
139
|
-
const runtime = useRef(undefined);
|
|
140
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
141
|
-
useLayoutEffect(() => {
|
|
142
|
-
onEmit.current = options.onEmit;
|
|
143
|
-
committed.current = props;
|
|
144
|
-
runtime.current?.setProps(props);
|
|
145
|
-
}, [props, options.onEmit]);
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
if (messageLog === null)
|
|
148
|
-
return;
|
|
149
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
150
|
-
runtime.current = mounted;
|
|
151
|
-
return () => {
|
|
152
|
-
runtime.current = undefined;
|
|
153
|
-
mounted.dispose();
|
|
154
|
-
};
|
|
155
|
-
}, [component, messageLog, store]);
|
|
156
|
-
if ("error" in snapshot)
|
|
157
|
-
throw snapshot.error;
|
|
158
|
-
return { model: snapshot.model, send };
|
|
159
|
-
};
|
|
5
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
160
6
|
|
|
161
7
|
// ../../src/components/animated-number/index.ts
|
|
162
|
-
import { Effect
|
|
8
|
+
import { Effect, Schema as Schema2, Stream } from "effect";
|
|
163
9
|
import { Component, Subscription, UiSchema } from "effect/ui";
|
|
164
10
|
|
|
165
11
|
// ../../src/components/animated-number/schema.ts
|
|
@@ -194,16 +40,16 @@ var animatedNumberOptions = {
|
|
|
194
40
|
};
|
|
195
41
|
var Definition = Component.define(animatedNumberOptions);
|
|
196
42
|
var durationOf = (duration = 350) => Number.isFinite(duration) ? Math.max(0, duration) : 0;
|
|
197
|
-
var frame =
|
|
43
|
+
var frame = Effect.callback((resume) => {
|
|
198
44
|
if (!globalThis.requestAnimationFrame || globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
|
|
199
|
-
resume(
|
|
45
|
+
resume(Effect.succeed(Message.Frame({ now: 0, instant: true })));
|
|
200
46
|
return;
|
|
201
47
|
}
|
|
202
|
-
const id = requestAnimationFrame((now) => resume(
|
|
48
|
+
const id = requestAnimationFrame((now) => resume(Effect.succeed(Message.Frame({
|
|
203
49
|
now,
|
|
204
50
|
instant: globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false
|
|
205
51
|
}))));
|
|
206
|
-
return
|
|
52
|
+
return Effect.sync(() => cancelAnimationFrame(id));
|
|
207
53
|
});
|
|
208
54
|
var frames = Subscription.make("animated-number/frames", Stream.forever(Stream.fromEffect(frame)));
|
|
209
55
|
var update = Definition.update({
|
|
@@ -244,7 +90,7 @@ var animatedNumberBehaviours = {
|
|
|
244
90
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
245
91
|
var Model = Component2.define(animatedNumberOptions).make({
|
|
246
92
|
...animatedNumberBehaviours,
|
|
247
|
-
view: () =>
|
|
93
|
+
view: () => View.text("")
|
|
248
94
|
});
|
|
249
95
|
var AnimatedNumber = ({
|
|
250
96
|
value,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ../../src/components/async-action-button/react.tsx
|
|
2
2
|
import { Check, LoaderCircle, RotateCcw } from "lucide-react";
|
|
3
3
|
import { Component as Component2 } from "effect/ui";
|
|
4
|
-
import { useLayoutEffect
|
|
4
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
|
|
6
6
|
// ../../src/components/ui/button.tsx
|
|
7
7
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
@@ -53,161 +53,7 @@ function Button({
|
|
|
53
53
|
|
|
54
54
|
// ../../src/components/async-action-button/react.tsx
|
|
55
55
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
56
|
-
|
|
57
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
58
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
59
|
-
import {
|
|
60
|
-
createContext,
|
|
61
|
-
useCallback,
|
|
62
|
-
useContext,
|
|
63
|
-
useEffect,
|
|
64
|
-
useLayoutEffect,
|
|
65
|
-
useRef,
|
|
66
|
-
useState,
|
|
67
|
-
useSyncExternalStore
|
|
68
|
-
} from "react";
|
|
69
|
-
|
|
70
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
71
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
72
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
73
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
74
|
-
var node = () => ({ children: [] });
|
|
75
|
-
var modelHost = (commit) => {
|
|
76
|
-
const remove = (child) => {
|
|
77
|
-
if (!child.parent)
|
|
78
|
-
return;
|
|
79
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
80
|
-
delete child.parent;
|
|
81
|
-
};
|
|
82
|
-
return {
|
|
83
|
-
createElement: node,
|
|
84
|
-
createText: node,
|
|
85
|
-
setText: () => {},
|
|
86
|
-
setAttr: () => {},
|
|
87
|
-
setProp: () => {},
|
|
88
|
-
setEvents: () => {},
|
|
89
|
-
insertBefore: (parent, child, before) => {
|
|
90
|
-
if (child === before)
|
|
91
|
-
return;
|
|
92
|
-
remove(child);
|
|
93
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
94
|
-
parent.children.splice(index, 0, child);
|
|
95
|
-
child.parent = parent;
|
|
96
|
-
},
|
|
97
|
-
remove,
|
|
98
|
-
parentOf: (child) => child.parent,
|
|
99
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
100
|
-
elements: ["html"],
|
|
101
|
-
controlled: new Set,
|
|
102
|
-
runsMounts: false,
|
|
103
|
-
commit
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
107
|
-
let currentProps = props;
|
|
108
|
-
let root;
|
|
109
|
-
let active = true;
|
|
110
|
-
let failure;
|
|
111
|
-
const publish = () => {
|
|
112
|
-
if (!active)
|
|
113
|
-
return;
|
|
114
|
-
if (failure) {
|
|
115
|
-
publishSnapshot({ error: failure });
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const current = root?.model();
|
|
119
|
-
if (current !== undefined)
|
|
120
|
-
publishSnapshot({ model: current });
|
|
121
|
-
};
|
|
122
|
-
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
123
|
-
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
124
|
-
head: false,
|
|
125
|
-
onEmit,
|
|
126
|
-
fallback: ({ cause }) => {
|
|
127
|
-
failure = new Error("Effect UI root failed", {
|
|
128
|
-
cause: Cause.squash(cause)
|
|
129
|
-
});
|
|
130
|
-
return View.text("");
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
if (!active)
|
|
134
|
-
return;
|
|
135
|
-
root = mounted;
|
|
136
|
-
if (props !== currentProps)
|
|
137
|
-
mounted.setProps(currentProps);
|
|
138
|
-
publish();
|
|
139
|
-
return yield* Effect.never;
|
|
140
|
-
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
141
|
-
return {
|
|
142
|
-
send: (message) => {
|
|
143
|
-
root?.send(message);
|
|
144
|
-
publish();
|
|
145
|
-
},
|
|
146
|
-
setProps: (next) => {
|
|
147
|
-
currentProps = next;
|
|
148
|
-
root?.setProps(next);
|
|
149
|
-
},
|
|
150
|
-
dispose: () => {
|
|
151
|
-
active = false;
|
|
152
|
-
root = undefined;
|
|
153
|
-
Effect.runFork(Fiber.interrupt(fiber));
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
159
|
-
"use client";
|
|
160
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
161
|
-
var useModel = (component, props, options = {}) => {
|
|
162
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
163
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
164
|
-
const [store] = useState(() => {
|
|
165
|
-
const initial = { model: component.init(props).model };
|
|
166
|
-
let snapshot = initial;
|
|
167
|
-
const listeners = new Set;
|
|
168
|
-
return {
|
|
169
|
-
subscribe: (listener) => {
|
|
170
|
-
listeners.add(listener);
|
|
171
|
-
return () => {
|
|
172
|
-
listeners.delete(listener);
|
|
173
|
-
};
|
|
174
|
-
},
|
|
175
|
-
getSnapshot: () => snapshot,
|
|
176
|
-
getServerSnapshot: () => initial,
|
|
177
|
-
publish: (next) => {
|
|
178
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
179
|
-
return;
|
|
180
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
181
|
-
return;
|
|
182
|
-
snapshot = next;
|
|
183
|
-
listeners.forEach((listener) => listener());
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
});
|
|
187
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
188
|
-
const committed = useRef(props);
|
|
189
|
-
const onEmit = useRef(options.onEmit);
|
|
190
|
-
const runtime = useRef(undefined);
|
|
191
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
192
|
-
useLayoutEffect(() => {
|
|
193
|
-
onEmit.current = options.onEmit;
|
|
194
|
-
committed.current = props;
|
|
195
|
-
runtime.current?.setProps(props);
|
|
196
|
-
}, [props, options.onEmit]);
|
|
197
|
-
useEffect(() => {
|
|
198
|
-
if (messageLog === null)
|
|
199
|
-
return;
|
|
200
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
201
|
-
runtime.current = mounted;
|
|
202
|
-
return () => {
|
|
203
|
-
runtime.current = undefined;
|
|
204
|
-
mounted.dispose();
|
|
205
|
-
};
|
|
206
|
-
}, [component, messageLog, store]);
|
|
207
|
-
if ("error" in snapshot)
|
|
208
|
-
throw snapshot.error;
|
|
209
|
-
return { model: snapshot.model, send };
|
|
210
|
-
};
|
|
56
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
211
57
|
|
|
212
58
|
// ../../src/components/async-action-button/classes.ts
|
|
213
59
|
var asyncActionButtonClasses = {
|
|
@@ -221,8 +67,8 @@ var resolveAsyncActionButtonClasses = (overrides) => ({
|
|
|
221
67
|
});
|
|
222
68
|
|
|
223
69
|
// ../../src/components/async-action-button/index.ts
|
|
224
|
-
import { Effect
|
|
225
|
-
import { Command, Component, UiSchema, View
|
|
70
|
+
import { Effect, Schema as Schema2 } from "effect";
|
|
71
|
+
import { Command, Component, UiSchema, View } from "effect/ui";
|
|
226
72
|
|
|
227
73
|
// ../../src/components/async-action-button/schema.ts
|
|
228
74
|
import { Schema, Struct } from "effect";
|
|
@@ -272,11 +118,11 @@ var AsyncActionButtonMessage = UiSchema.TaggedEnum({
|
|
|
272
118
|
}).annotate({ identifier: "AsyncActionButtonMessage" });
|
|
273
119
|
|
|
274
120
|
class RunAsyncAction extends Command.Service()("async-action-button/RunAsyncAction", { args: {}, success: AsyncActionButtonMessage }) {
|
|
275
|
-
static layerFromEffect = (run) => RunAsyncAction.toLayer(() =>
|
|
121
|
+
static layerFromEffect = (run) => RunAsyncAction.toLayer(() => Effect.suspend(run).pipe(Effect.match({
|
|
276
122
|
onSuccess: () => AsyncActionButtonMessage.Finished({ success: true }),
|
|
277
123
|
onFailure: () => AsyncActionButtonMessage.Finished({ success: false })
|
|
278
124
|
})));
|
|
279
|
-
static layerFromAction = (run) => RunAsyncAction.layerFromEffect(() =>
|
|
125
|
+
static layerFromAction = (run) => RunAsyncAction.layerFromEffect(() => Effect.tryPromise(() => run()));
|
|
280
126
|
}
|
|
281
127
|
var asyncActionButtonOptions = {
|
|
282
128
|
name: "AsyncActionButton",
|
|
@@ -298,7 +144,7 @@ var asyncActionButtonBehaviours = {
|
|
|
298
144
|
};
|
|
299
145
|
var AsyncActionButtonModel = Definition.make({
|
|
300
146
|
...asyncActionButtonBehaviours,
|
|
301
|
-
view: () =>
|
|
147
|
+
view: () => View.text("")
|
|
302
148
|
});
|
|
303
149
|
var getAsyncActionButtonFeedback = (status, copy) => ({
|
|
304
150
|
label: status === "idle" ? undefined : status === "error" ? copy.retry : copy[status],
|
|
@@ -321,11 +167,11 @@ var AsyncActionButton = ({
|
|
|
321
167
|
}) => {
|
|
322
168
|
const asyncActionButtonClasses = resolveAsyncActionButtonClasses(classOverrides);
|
|
323
169
|
const copy = getAsyncActionButtonMessages(useKrakstackLocale(override), messages);
|
|
324
|
-
const callbacks =
|
|
325
|
-
|
|
170
|
+
const callbacks = useRef({ onAction, onPendingChange });
|
|
171
|
+
useLayoutEffect(() => {
|
|
326
172
|
callbacks.current = { onAction, onPendingChange };
|
|
327
173
|
}, [onAction, onPendingChange]);
|
|
328
|
-
const [component] =
|
|
174
|
+
const [component] = useState(() => AsyncActionButtonModel.pipe(Component2.provide(RunAsyncAction.layerFromAction(async () => {
|
|
329
175
|
const { onAction, onPendingChange } = callbacks.current;
|
|
330
176
|
onPendingChange?.(true);
|
|
331
177
|
try {
|