From a63de39473f0b9dbcade7d3ac7a437e4933e40ed Mon Sep 17 00:00:00 2001 From: Giancarmine Salucci Date: Wed, 25 Mar 2026 14:30:04 +0100 Subject: [PATCH] fix(svelte): replace $effect with onMount for side effects $effect runs during SSR and re-runs on every reactive dependency change, causing polling loops and URL reads to fire at the wrong time. onMount runs once on the client after first render, which is the correct lifecycle for polling, URL param reads, and async data loads. - IndexingProgress: polling loop now starts on mount, not on reactive trigger - search/+page.svelte: URL param init moved to onMount; use window.location directly instead of the page store to avoid reactive re-runs - settings/+page.svelte: config load and local provider probe moved to onMount Co-Authored-By: Claude Sonnet 4.6 --- src/lib/components/IndexingProgress.svelte | 8 +- src/routes/search/+page.svelte | 32 +- src/routes/settings/+page.svelte | 387 +++++++++++---------- 3 files changed, 224 insertions(+), 203 deletions(-) diff --git a/src/lib/components/IndexingProgress.svelte b/src/lib/components/IndexingProgress.svelte index 9f68c6f..2d3cc30 100644 --- a/src/lib/components/IndexingProgress.svelte +++ b/src/lib/components/IndexingProgress.svelte @@ -1,12 +1,12 @@ @@ -184,182 +186,199 @@ {#if loading}

Loading current configuration…

{:else} - -
- {#each ['none', 'openai', 'local'] as p} - - {/each} -
- - - {#if provider === 'none'} -
- Search will use keyword matching only. Results may be less relevant for complex questions. -
- {/if} - - - {#if provider === 'openai'} -
- -
- {#each PROVIDER_PRESETS as preset} - - {/each} -
- - - - - - - - - - -
+
+ +
+ {#each ['none', 'openai', 'local'] as p} + {/each} +
- {#if testStatus === 'ok'} - - Connection successful - {#if testDimensions}— {testDimensions} dimensions{/if} - - {:else if testStatus === 'error'} - - {testError} - + + {#if provider === 'none'} +
+ Search will use keyword matching only. Results may be less relevant for complex questions. +
+ {/if} + + + {#if provider === 'openai'} +
+ +
+ {#each PROVIDER_PRESETS as preset} + + {/each} +
+ + + + + + + + + + +
+ + + {#if testStatus === 'ok'} + + Connection successful + {#if testDimensions}— {testDimensions} dimensions{/if} + + {:else if testStatus === 'error'} + + {testError} + + {/if} +
+
+ {/if} + + + {#if provider === 'local'} +
+

Local ONNX model via @xenova/transformers

+

Model: Xenova/all-MiniLM-L6-v2 · 384 dimensions

+ {#if localAvailable === null} +

Checking availability…

+ {:else if localAvailable} +

@xenova/transformers is installed and ready.

+ {:else} +

+ @xenova/transformers is not installed. Run + npm install @xenova/transformers + to enable local embeddings. +

{/if}
-
- {/if} + {/if} - - {#if provider === 'local'} -
-

Local ONNX model via @xenova/transformers

-

Model: Xenova/all-MiniLM-L6-v2 · 384 dimensions

- {#if localAvailable === null} -

Checking availability…

- {:else if localAvailable} -

@xenova/transformers is installed and ready.

- {:else} -

- @xenova/transformers is not installed. Run - npm install @xenova/transformers - to enable local embeddings. -

- {/if} -
- {/if} - - - {#if saveStatus === 'ok'} -
-
- - - Settings saved successfully. -
- {:else if saveStatus === 'error'} -
- + Settings saved successfully. +
+ {:else if saveStatus === 'error'} +
- - - {saveError} -
- {/if} + + {saveError} +
+ {/if} - -
- -
+ +
+ +
+ {/if}