mirror of https://github.com/buster-so/buster.git
kill electric when finished streams
This commit is contained in:
parent
1a46465aaa
commit
dac18b5861
|
@ -13,6 +13,7 @@ const updateOperations: Array<`insert` | `update` | `delete`> = ['update'];
|
|||
export const useTrackAndUpdateChatChanges = (
|
||||
{
|
||||
chatId,
|
||||
isStreamingMessage,
|
||||
}: {
|
||||
chatId: string | undefined;
|
||||
isStreamingMessage: boolean;
|
||||
|
@ -23,7 +24,7 @@ export const useTrackAndUpdateChatChanges = (
|
|||
const shape = useMemo(() => {
|
||||
return chatShape({ chatId: chatId || '' });
|
||||
}, [chatId]);
|
||||
const subscribe = !!chatId;
|
||||
const subscribe = !!chatId && isStreamingMessage;
|
||||
|
||||
return useShapeStream(
|
||||
shape,
|
||||
|
|
|
@ -33,6 +33,7 @@ export const useTrackAndUpdateMessageChanges = (
|
|||
{
|
||||
chatId,
|
||||
messageId,
|
||||
isStreamingMessage,
|
||||
}: {
|
||||
chatId: string | undefined;
|
||||
messageId: string;
|
||||
|
@ -45,7 +46,7 @@ export const useTrackAndUpdateMessageChanges = (
|
|||
const getChatMemoized = useGetChatMemoized();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const subscribe = !!chatId && !!messageId && messageId !== 'undefined';
|
||||
const subscribe = !!chatId && !!messageId && messageId !== 'undefined' && isStreamingMessage;
|
||||
|
||||
const shape = useMemo(() => {
|
||||
return messageShape({ chatId: chatId || '', messageId });
|
||||
|
|
|
@ -7,6 +7,7 @@ import { createDropdownItem } from '@/components/ui/dropdown';
|
|||
import { ArrowRight, DuplicatePlus, Pencil, ShareRight, Star, Trash } from '@/components/ui/icons';
|
||||
import { Star as StarFilled } from '@/components/ui/icons/NucleoIconFilled';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
import { ensureElementExists } from '@/lib/element';
|
||||
import { getIsEffectiveOwner } from '@/lib/share';
|
||||
import { timeout } from '@/lib/timeout';
|
||||
import { getShareAssetConfig, ShareMenuContent } from '../ShareMenu';
|
||||
|
@ -45,12 +46,18 @@ export const useRenameChatTitle = () => {
|
|||
label: 'Rename',
|
||||
value: 'edit-chat-title',
|
||||
icon: <Pencil />,
|
||||
onClick: async () => {
|
||||
const input = document.getElementById(CHAT_HEADER_TITLE_ID) as HTMLInputElement;
|
||||
onClick: async (e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
const input = await ensureElementExists(
|
||||
() => document.getElementById(CHAT_HEADER_TITLE_ID) as HTMLInputElement
|
||||
);
|
||||
if (input) {
|
||||
await timeout(25);
|
||||
// Focus first, then select after a small delay to ensure focus completes
|
||||
input.focus();
|
||||
input.select();
|
||||
setTimeout(() => {
|
||||
input.select(); //i think this is related to how the dropdown is closing and taking away focus
|
||||
}, 200);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
|
|
@ -11,7 +11,6 @@ import {
|
|||
import { chatQueryKeys } from '@/api/query_keys/chat';
|
||||
import { metricsQueryKeys } from '@/api/query_keys/metric';
|
||||
import { useBlackboxMessage } from '@/context/BlackBox/useBlackboxMessage';
|
||||
import { updateDocumentTitle } from '@/hooks/useDocumentTitle';
|
||||
import { useMemoizedFn } from '@/hooks/useMemoizedFn';
|
||||
import { updateChatToIChat } from '@/lib/chat';
|
||||
|
||||
|
|
Loading…
Reference in New Issue