🐛 Silence SignalDB warnings for reads outside reactive scopes

Every read outside a reactive scope passed { reactive: false } and made
Cursor.depend() log a warning. Such reads now use a silent reactivity
adapter, and all, get, pendingCount and save release the cursor again
with cleanup(), so nothing is registered and nothing leaks. Reads inside
$derived or $effect stay reactive as before.

Vitest now resolves the browser export of Svelte. Without it
svelte/reactivity is the server stub, createSubscriber never starts and
no effect re-runs after a write in tests.
This commit is contained in:
2026-12-01 17:02:53 +01:00
parent 73359d3f39
commit bd2ec79a69
4 changed files with 137 additions and 13 deletions
+4 -2
View File
@@ -8,7 +8,9 @@ import { VitePWA } from 'vite-plugin-pwa';
// generated — so we add it explicitly here instead.
const buildId = Date.now().toString();
export default defineConfig({
export default defineConfig(({ mode }) => ({
// Vitest resolves the `browser` export of Svelte, so effects re-run in tests like in the app.
resolve: { conditions: mode === 'test' ? ['browser'] : [] },
plugins: [
sveltekit(),
VitePWA({
@@ -58,4 +60,4 @@ export default defineConfig({
include: ['src/**/*.test.ts'],
setupFiles: ['./src/lib/test-setup.ts']
}
});
}));