@comergehq/studio 0.1.16 → 0.1.17
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/dist/index.js
CHANGED
|
@@ -894,9 +894,8 @@ function useThreadMessages(threadId) {
|
|
|
894
894
|
const activeRequestIdRef = React4.useRef(0);
|
|
895
895
|
const foregroundSignal = useForegroundSignal(Boolean(threadId));
|
|
896
896
|
const upsertSorted = React4.useCallback((prev, m) => {
|
|
897
|
-
const include = !isQueuedHiddenMessage(m);
|
|
898
897
|
const next = prev.filter((x) => x.id !== m.id);
|
|
899
|
-
|
|
898
|
+
next.push(m);
|
|
900
899
|
next.sort(compareMessages);
|
|
901
900
|
return next;
|
|
902
901
|
}, []);
|
|
@@ -911,7 +910,7 @@ function useThreadMessages(threadId) {
|
|
|
911
910
|
try {
|
|
912
911
|
const list = await messagesRepository.list(threadId);
|
|
913
912
|
if (activeRequestIdRef.current !== requestId) return;
|
|
914
|
-
setRaw([...list].
|
|
913
|
+
setRaw([...list].sort(compareMessages));
|
|
915
914
|
} catch (e) {
|
|
916
915
|
if (activeRequestIdRef.current !== requestId) return;
|
|
917
916
|
setError(e instanceof Error ? e : new Error(String(e)));
|
|
@@ -937,7 +936,11 @@ function useThreadMessages(threadId) {
|
|
|
937
936
|
if (foregroundSignal <= 0) return;
|
|
938
937
|
void refetch();
|
|
939
938
|
}, [foregroundSignal, refetch, threadId]);
|
|
940
|
-
const messages = React4.useMemo(() =>
|
|
939
|
+
const messages = React4.useMemo(() => {
|
|
940
|
+
const visible = raw.filter((m) => !isQueuedHiddenMessage(m));
|
|
941
|
+
const resolved = visible.length > 0 ? visible : raw;
|
|
942
|
+
return resolved.map(mapMessageToChatMessage);
|
|
943
|
+
}, [raw]);
|
|
941
944
|
return { raw, messages, loading, error, refetch };
|
|
942
945
|
}
|
|
943
946
|
|
|
@@ -1981,7 +1984,6 @@ function useStudioActions({
|
|
|
1981
1984
|
setSending(true);
|
|
1982
1985
|
setError(null);
|
|
1983
1986
|
try {
|
|
1984
|
-
onEditStart == null ? void 0 : onEditStart();
|
|
1985
1987
|
let targetApp = app;
|
|
1986
1988
|
if (shouldForkOnEdit) {
|
|
1987
1989
|
setForking(true);
|
|
@@ -1993,6 +1995,7 @@ function useStudioActions({
|
|
|
1993
1995
|
setForking(false);
|
|
1994
1996
|
const threadId = targetApp.threadId;
|
|
1995
1997
|
if (!threadId) throw new Error("No thread available for this app.");
|
|
1998
|
+
onEditStart == null ? void 0 : onEditStart();
|
|
1996
1999
|
let attachmentMetas;
|
|
1997
2000
|
if (attachments && attachments.length > 0 && uploadAttachments) {
|
|
1998
2001
|
attachmentMetas = await uploadAttachments({ threadId, appId: targetApp.id, dataUrls: attachments });
|
|
@@ -6900,7 +6903,9 @@ function StudioOverlay({
|
|
|
6900
6903
|
const [commentsAppId, setCommentsAppId] = React43.useState(null);
|
|
6901
6904
|
const [commentsCount, setCommentsCount] = React43.useState(null);
|
|
6902
6905
|
const threadId = (app == null ? void 0 : app.threadId) ?? null;
|
|
6903
|
-
const
|
|
6906
|
+
const isForking = chatForking || (app == null ? void 0 : app.status) === "forking";
|
|
6907
|
+
const queueItemsForChat = isForking ? [] : chatQueueItems;
|
|
6908
|
+
const disableOptimistic = Boolean(queueItemsForChat && queueItemsForChat.length > 0) || (app == null ? void 0 : app.status) === "editing";
|
|
6904
6909
|
const optimistic = useOptimisticChatMessages({
|
|
6905
6910
|
threadId,
|
|
6906
6911
|
shouldForkOnEdit,
|
|
@@ -7042,7 +7047,7 @@ function StudioOverlay({
|
|
|
7042
7047
|
onNavigateHome,
|
|
7043
7048
|
onStartDraw: startDraw,
|
|
7044
7049
|
onSend: optimistic.onSend,
|
|
7045
|
-
queueItems:
|
|
7050
|
+
queueItems: queueItemsForChat,
|
|
7046
7051
|
onRemoveQueueItem
|
|
7047
7052
|
}
|
|
7048
7053
|
)
|