diff --git a/app/src/lib/components/ChatBoxAndWidget.svelte b/app/src/lib/components/ChatBoxAndWidget.svelte index 8eb7fe3..18fda6b 100644 --- a/app/src/lib/components/ChatBoxAndWidget.svelte +++ b/app/src/lib/components/ChatBoxAndWidget.svelte @@ -16,11 +16,11 @@ import { createEventDispatcher } from 'svelte'; import ChatBoxAttachment from './ChatBoxAttachment.svelte'; import ChatBoxAttachmentPreview from './ChatBoxAttachmentPreview.svelte'; - import { setAttachmentsContext } from '@/stores/attachmentsContext.svelte'; + import { getAttachmentsContext } from '@/stores/attachmentsContext.svelte'; export let searchTerm = ''; - const { uploadedItems$ } = setAttachmentsContext(); + const { uploadedItems$ } = getAttachmentsContext(); const dispatch = createEventDispatcher<{ submitSearch: { value: string }; diff --git a/app/src/lib/stores/attachmentsContext.svelte.ts b/app/src/lib/stores/attachmentsContext.svelte.ts index df4fc59..9c54334 100644 --- a/app/src/lib/stores/attachmentsContext.svelte.ts +++ b/app/src/lib/stores/attachmentsContext.svelte.ts @@ -20,4 +20,5 @@ export const setAttachmentsContext = () => { export type AttachmentsContext = ReturnType; -export const getAttachmentsContext = () => getContext(CONTEXT_KEY); +export const getAttachmentsContext = () => + getContext(CONTEXT_KEY) || setAttachmentsContext();