@assistant-ui/react 0.7.10 → 0.7.12
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.d.ts +1 -1
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts +1 -3
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/primitives/assistantModal/scope.d.ts +2 -6
- package/dist/primitives/assistantModal/scope.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.d.ts +1 -3
- package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.d.ts +1 -3
- package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.d.ts +1 -3
- package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts +1 -3
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +1 -3
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +1 -3
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts +1 -3
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerCancel.d.ts +1 -3
- package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +2 -2
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.mjs +2 -2
- package/dist/primitives/composer/ComposerInput.mjs.map +1 -1
- package/dist/primitives/composer/ComposerRoot.d.ts +1 -3
- package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerSend.d.ts +1 -3
- package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
- package/dist/primitives/contentPart/ContentPartImage.d.ts +1 -3
- package/dist/primitives/contentPart/ContentPartImage.d.ts.map +1 -1
- package/dist/primitives/contentPart/ContentPartText.d.ts +1 -3
- package/dist/primitives/contentPart/ContentPartText.d.ts.map +1 -1
- package/dist/primitives/message/MessageRoot.d.ts +1 -3
- package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadRoot.d.ts +1 -3
- package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts +1 -3
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts +1 -3
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts +1 -3
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.d.ts +1 -3
- package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +1 -3
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts +2 -0
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js +8 -0
- package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs +8 -0
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +2 -2
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +7 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs +7 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +3 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +3 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +0 -2
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +2 -9
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +2 -9
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/ui/assistant-action-bar.d.ts +1 -3
- package/dist/ui/assistant-action-bar.d.ts.map +1 -1
- package/dist/ui/assistant-message.d.ts +1 -3
- package/dist/ui/assistant-message.d.ts.map +1 -1
- package/dist/ui/attachment-ui.d.ts +1 -3
- package/dist/ui/attachment-ui.d.ts.map +1 -1
- package/dist/ui/base/button.d.ts +1 -3
- package/dist/ui/base/button.d.ts.map +1 -1
- package/dist/ui/base/tooltip-icon-button.d.ts +1 -3
- package/dist/ui/base/tooltip-icon-button.d.ts.map +1 -1
- package/dist/ui/branch-picker.d.ts +1 -3
- package/dist/ui/branch-picker.d.ts.map +1 -1
- package/dist/ui/composer.d.ts +1 -3
- package/dist/ui/composer.d.ts.map +1 -1
- package/dist/ui/edit-composer.d.ts +1 -3
- package/dist/ui/edit-composer.d.ts.map +1 -1
- package/dist/ui/thread-list-item.d.ts +1 -3
- package/dist/ui/thread-list-item.d.ts.map +1 -1
- package/dist/ui/thread-list.d.ts +1 -3
- package/dist/ui/thread-list.d.ts.map +1 -1
- package/dist/ui/thread.d.ts +2 -6
- package/dist/ui/thread.d.ts.map +1 -1
- package/dist/ui/user-action-bar.d.ts +1 -3
- package/dist/ui/user-action-bar.d.ts.map +1 -1
- package/dist/ui/user-message.d.ts +1 -3
- package/dist/ui/user-message.d.ts.map +1 -1
- package/dist/utils/createActionButton.d.ts +1 -3
- package/dist/utils/createActionButton.d.ts.map +1 -1
- package/dist/utils/hooks/useManagedRef.js +1 -1
- package/dist/utils/hooks/useManagedRef.js.map +1 -1
- package/dist/utils/hooks/useManagedRef.mjs +1 -1
- package/dist/utils/hooks/useManagedRef.mjs.map +1 -1
- package/package.json +21 -21
- package/src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx +1 -1
- package/src/primitives/composer/ComposerInput.tsx +2 -2
- package/src/runtimes/core/BaseThreadRuntimeCore.tsx +10 -0
- package/src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx +11 -2
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +4 -1
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +2 -11
- package/src/utils/hooks/useManagedRef.ts +1 -1
- package/edge/package-lock.json +0 -6
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/hooks/useManagedRef.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\n\nexport const useManagedRef = <TNode>(\n callback: (node: TNode) => (() => void) | void,\n) => {\n const cleanupRef = useRef<(() => void) | void>();\n\n const ref = useCallback(\n (el: TNode | null) => {\n // Call the previous cleanup function\n if (cleanupRef.current) {\n cleanupRef.current();\n }\n\n // Call the new callback and store its cleanup function\n if (el) {\n cleanupRef.current = callback(el);\n }\n },\n [callback],\n );\n\n return ref;\n};\n"],"mappings":";AAAA,SAAS,aAAa,cAAc;AAE7B,IAAM,gBAAgB,CAC3B,aACG;AACH,QAAM,aAAa,OAA4B;
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/useManagedRef.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\n\nexport const useManagedRef = <TNode>(\n callback: (node: TNode) => (() => void) | void,\n) => {\n const cleanupRef = useRef<(() => void) | void>(undefined);\n\n const ref = useCallback(\n (el: TNode | null) => {\n // Call the previous cleanup function\n if (cleanupRef.current) {\n cleanupRef.current();\n }\n\n // Call the new callback and store its cleanup function\n if (el) {\n cleanupRef.current = callback(el);\n }\n },\n [callback],\n );\n\n return ref;\n};\n"],"mappings":";AAAA,SAAS,aAAa,cAAc;AAE7B,IAAM,gBAAgB,CAC3B,aACG;AACH,QAAM,aAAa,OAA4B,MAAS;AAExD,QAAM,MAAM;AAAA,IACV,CAAC,OAAqB;AAEpB,UAAI,WAAW,SAAS;AACtB,mBAAW,QAAQ;AAAA,MACrB;AAGA,UAAI,IAAI;AACN,mBAAW,UAAU,SAAS,EAAE;AAAA,MAClC;AAAA,IACF;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
"conversational-ui",
|
30
30
|
"conversational-ai"
|
31
31
|
],
|
32
|
-
"version": "0.7.
|
32
|
+
"version": "0.7.12",
|
33
33
|
"license": "MIT",
|
34
34
|
"exports": {
|
35
35
|
".": {
|
@@ -65,28 +65,28 @@
|
|
65
65
|
],
|
66
66
|
"sideEffects": false,
|
67
67
|
"dependencies": {
|
68
|
-
"@ai-sdk/provider": "^1.0.
|
69
|
-
"@radix-ui/primitive": "^1.1.
|
70
|
-
"@radix-ui/react-avatar": "^1.1.
|
71
|
-
"@radix-ui/react-compose-refs": "^1.1.
|
68
|
+
"@ai-sdk/provider": "^1.0.2",
|
69
|
+
"@radix-ui/primitive": "^1.1.1",
|
70
|
+
"@radix-ui/react-avatar": "^1.1.2",
|
71
|
+
"@radix-ui/react-compose-refs": "^1.1.1",
|
72
72
|
"@radix-ui/react-context": "^1.1.1",
|
73
|
-
"@radix-ui/react-dialog": "^1.1.
|
74
|
-
"@radix-ui/react-popover": "^1.1.
|
75
|
-
"@radix-ui/react-primitive": "^2.0.
|
76
|
-
"@radix-ui/react-slot": "^1.1.
|
77
|
-
"@radix-ui/react-tooltip": "^1.1.
|
73
|
+
"@radix-ui/react-dialog": "^1.1.3",
|
74
|
+
"@radix-ui/react-popover": "^1.1.3",
|
75
|
+
"@radix-ui/react-primitive": "^2.0.1",
|
76
|
+
"@radix-ui/react-slot": "^1.1.1",
|
77
|
+
"@radix-ui/react-tooltip": "^1.1.5",
|
78
78
|
"@radix-ui/react-use-callback-ref": "^1.1.0",
|
79
79
|
"@radix-ui/react-use-escape-keydown": "^1.1.0",
|
80
|
-
"class-variance-authority": "^0.7.
|
80
|
+
"class-variance-authority": "^0.7.1",
|
81
81
|
"classnames": "^2.5.1",
|
82
82
|
"json-schema": "^0.4.0",
|
83
|
-
"lucide-react": "^0.
|
84
|
-
"nanoid": "^5.0.
|
85
|
-
"react-textarea-autosize": "^8.5.
|
83
|
+
"lucide-react": "^0.468.0",
|
84
|
+
"nanoid": "^5.0.9",
|
85
|
+
"react-textarea-autosize": "^8.5.6",
|
86
86
|
"secure-json-parse": "^3.0.1",
|
87
|
-
"zod": "^3.
|
88
|
-
"zod-to-json-schema": "^3.
|
89
|
-
"zustand": "^5.0.
|
87
|
+
"zod": "^3.24.1",
|
88
|
+
"zod-to-json-schema": "^3.24.1",
|
89
|
+
"zustand": "^5.0.2"
|
90
90
|
},
|
91
91
|
"peerDependencies": {
|
92
92
|
"@types/react": "*",
|
@@ -108,15 +108,15 @@
|
|
108
108
|
},
|
109
109
|
"devDependencies": {
|
110
110
|
"@types/json-schema": "^7.0.15",
|
111
|
-
"@types/node": "^22.
|
111
|
+
"@types/node": "^22.10.2",
|
112
112
|
"autoprefixer": "^10.4.20",
|
113
|
-
"esbuild-plugin-file-path-extensions": "^2.1.
|
113
|
+
"esbuild-plugin-file-path-extensions": "^2.1.4",
|
114
114
|
"eslint": "^9",
|
115
|
-
"eslint-config-next": "15.0
|
115
|
+
"eslint-config-next": "15.1.0",
|
116
116
|
"postcss": "^8.4.49",
|
117
117
|
"postcss-js": "^4.0.1",
|
118
118
|
"postcss-nested": "^7.0.2",
|
119
|
-
"tailwindcss": "^3.4.
|
119
|
+
"tailwindcss": "^3.4.16",
|
120
120
|
"tailwindcss-animate": "^1.0.7",
|
121
121
|
"tsup": "8.3.5",
|
122
122
|
"tsx": "^4.19.2",
|
@@ -18,7 +18,7 @@ export type UseThreadViewportAutoScrollProps = {
|
|
18
18
|
export const useThreadViewportAutoScroll = <TElement extends HTMLElement>({
|
19
19
|
autoScroll = true,
|
20
20
|
unstable_scrollToBottomOnRunStart = true,
|
21
|
-
}: UseThreadViewportAutoScrollProps) => {
|
21
|
+
}: UseThreadViewportAutoScrollProps): React.RefCallback<TElement> => {
|
22
22
|
const divRef = useRef<TElement>(null);
|
23
23
|
|
24
24
|
const threadViewportStore = useThreadViewportStore();
|
@@ -102,8 +102,8 @@ export const ComposerPrimitiveInput = forwardRef<
|
|
102
102
|
|
103
103
|
textarea.focus({ preventScroll: true });
|
104
104
|
textarea.setSelectionRange(
|
105
|
-
|
106
|
-
|
105
|
+
textarea.value.length,
|
106
|
+
textarea.value.length,
|
107
107
|
);
|
108
108
|
}, [autoFocusEnabled]);
|
109
109
|
|
@@ -32,6 +32,7 @@ type BaseThreadAdapters = {
|
|
32
32
|
|
33
33
|
export abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
|
34
34
|
private _subscriptions = new Set<() => void>();
|
35
|
+
private _isInitialized = false;
|
35
36
|
|
36
37
|
protected readonly repository = new MessageRepository();
|
37
38
|
public abstract get adapters(): BaseThreadAdapters | undefined;
|
@@ -161,11 +162,20 @@ export abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
|
|
161
162
|
this._notifySubscribers();
|
162
163
|
}
|
163
164
|
|
165
|
+
protected ensureInitialized() {
|
166
|
+
if (!this._isInitialized) {
|
167
|
+
this._isInitialized = true;
|
168
|
+
this._notifyEventSubscribers("initialize");
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
164
172
|
public export() {
|
165
173
|
return this.repository.export();
|
166
174
|
}
|
167
175
|
|
168
176
|
public import(data: ExportedMessageRepository) {
|
177
|
+
this.ensureInitialized();
|
178
|
+
|
169
179
|
this.repository.import(data);
|
170
180
|
this._notifySubscribers();
|
171
181
|
}
|
@@ -1,18 +1,26 @@
|
|
1
1
|
import type { Unsubscribe } from "../../types";
|
2
2
|
import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
|
3
3
|
import { ThreadListRuntimeCore } from "../core/ThreadListRuntimeCore";
|
4
|
-
import {
|
4
|
+
import {
|
5
|
+
ExternalStoreThreadData,
|
6
|
+
ExternalStoreThreadListAdapter,
|
7
|
+
} from "./ExternalStoreAdapter";
|
5
8
|
|
6
9
|
export type ExternalStoreThreadFactory = () => ExternalStoreThreadRuntimeCore;
|
7
10
|
|
8
11
|
const EMPTY_ARRAY = Object.freeze([]);
|
9
12
|
const DEFAULT_THREAD_ID = "DEFAULT_THREAD_ID";
|
13
|
+
const DEFAULT_THREADS = Object.freeze([DEFAULT_THREAD_ID]);
|
14
|
+
const DEFAULT_THREAD: ExternalStoreThreadData<"regular"> = Object.freeze({
|
15
|
+
threadId: DEFAULT_THREAD_ID,
|
16
|
+
state: "regular",
|
17
|
+
});
|
10
18
|
|
11
19
|
export class ExternalStoreThreadListRuntimeCore
|
12
20
|
implements ThreadListRuntimeCore
|
13
21
|
{
|
14
22
|
private _mainThreadId: string = DEFAULT_THREAD_ID;
|
15
|
-
private _threads: readonly string[] =
|
23
|
+
private _threads: readonly string[] = DEFAULT_THREADS;
|
16
24
|
private _archivedThreads: readonly string[] = EMPTY_ARRAY;
|
17
25
|
|
18
26
|
public get newThreadId() {
|
@@ -51,6 +59,7 @@ export class ExternalStoreThreadListRuntimeCore
|
|
51
59
|
for (const thread of this.adapter.archivedThreads ?? []) {
|
52
60
|
if (thread.threadId === threadId) return thread;
|
53
61
|
}
|
62
|
+
if (threadId === DEFAULT_THREAD_ID) return DEFAULT_THREAD;
|
54
63
|
return undefined;
|
55
64
|
}
|
56
65
|
|
@@ -133,8 +133,9 @@ export class ExternalStoreThreadRuntimeCore
|
|
133
133
|
)
|
134
134
|
return cache;
|
135
135
|
|
136
|
+
const messageLike = store.convertMessage(m, idx);
|
136
137
|
const newMessage = fromThreadMessageLike(
|
137
|
-
|
138
|
+
messageLike,
|
138
139
|
idx.toString(),
|
139
140
|
autoStatus,
|
140
141
|
);
|
@@ -142,6 +143,8 @@ export class ExternalStoreThreadRuntimeCore
|
|
142
143
|
return newMessage;
|
143
144
|
});
|
144
145
|
|
146
|
+
if (messages.length > 0) this.ensureInitialized();
|
147
|
+
|
145
148
|
for (let i = 0; i < messages.length; i++) {
|
146
149
|
const message = messages[i]!;
|
147
150
|
const parent = messages[i - 1];
|
@@ -19,8 +19,6 @@ export class LocalThreadRuntimeCore
|
|
19
19
|
extends BaseThreadRuntimeCore
|
20
20
|
implements ThreadRuntimeCore
|
21
21
|
{
|
22
|
-
private _isInitialized = false;
|
23
|
-
|
24
22
|
public readonly capabilities = {
|
25
23
|
switchToBranch: true,
|
26
24
|
edit: true,
|
@@ -83,15 +81,8 @@ export class LocalThreadRuntimeCore
|
|
83
81
|
if (hasUpdates) this._notifySubscribers();
|
84
82
|
}
|
85
83
|
|
86
|
-
private _ensureInitialized() {
|
87
|
-
if (!this._isInitialized) {
|
88
|
-
this._isInitialized = true;
|
89
|
-
this._notifyEventSubscribers("initialize");
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
84
|
public async append(message: AppendMessage): Promise<void> {
|
94
|
-
this.
|
85
|
+
this.ensureInitialized();
|
95
86
|
|
96
87
|
const newMessage = fromCoreMessage(message, {
|
97
88
|
attachments: message.attachments,
|
@@ -108,7 +99,7 @@ export class LocalThreadRuntimeCore
|
|
108
99
|
}
|
109
100
|
|
110
101
|
public async startRun(parentId: string | null): Promise<void> {
|
111
|
-
this.
|
102
|
+
this.ensureInitialized();
|
112
103
|
|
113
104
|
this.repository.resetHead(parentId);
|
114
105
|
|
@@ -3,7 +3,7 @@ import { useCallback, useRef } from "react";
|
|
3
3
|
export const useManagedRef = <TNode>(
|
4
4
|
callback: (node: TNode) => (() => void) | void,
|
5
5
|
) => {
|
6
|
-
const cleanupRef = useRef<(() => void) | void>();
|
6
|
+
const cleanupRef = useRef<(() => void) | void>(undefined);
|
7
7
|
|
8
8
|
const ref = useCallback(
|
9
9
|
(el: TNode | null) => {
|