Skip to content

Commit 5ee2f29

Browse files
committed
fix: Use proper lifecycle hook
1 parent e7aa527 commit 5ee2f29

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebarConversationItem.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import Input from '$lib/components/ui/input/input.svelte';
55
import { Trash2, Pencil, MoreHorizontal } from '@lucide/svelte';
66
import { KeyboardShortcutInfo } from '$lib/components/app';
7+
import { onMount } from 'svelte';
78
89
interface Props {
910
isActive?: boolean;
@@ -60,16 +61,14 @@
6061
onSelect?.(conversation.id);
6162
}
6263
63-
// Listen for global edit event
6464
function handleGlobalEditEvent(event: Event) {
6565
const customEvent = event as CustomEvent<{ conversationId: string }>;
6666
if (customEvent.detail.conversationId === conversation.id && isActive) {
6767
handleEdit(event);
6868
}
6969
}
7070
71-
// Add event listener when component mounts
72-
$effect(() => {
71+
onMount(() => {
7372
document.addEventListener('edit-active-conversation', handleGlobalEditEvent as EventListener);
7473
7574
return () => {

0 commit comments

Comments
 (0)