From 3e81a6ebefbbf0bd3c75e6fb65f8d4c8688a6752 Mon Sep 17 00:00:00 2001 From: Till JS Date: Fri, 10 Apr 2026 18:33:41 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20dev=20startup=20=E2=80=94=20Redis=20evic?= =?UTF-8?q?tion=20policy,=20mana-media=20port=20crash,=20Svelte=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Redis: allkeys-lru → noeviction to prevent silent data loss when memory full - mana-media: --watch → --hot to fix EADDRINUSE crash on Bun HMR reload - Svelte: build initial values before $state() to avoid state_referenced_locally warnings in create-app-onboarding.svelte.ts and shared-llm/store.svelte.ts Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/mana/apps/web/src/lib/data/sync.ts | 8 +++++ docker-compose.dev.yml | 2 +- packages/shared-llm/src/store.svelte.ts | 5 +-- .../create-app-onboarding.svelte.ts | 32 +++++++------------ services/mana-media/apps/api/package.json | 2 +- services/mana-search/docker-compose.dev.yml | 2 +- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/apps/mana/apps/web/src/lib/data/sync.ts b/apps/mana/apps/web/src/lib/data/sync.ts index 4eacadf4f..ef65a6c2b 100644 --- a/apps/mana/apps/web/src/lib/data/sync.ts +++ b/apps/mana/apps/web/src/lib/data/sync.ts @@ -724,6 +724,14 @@ export function createUnifiedSync(serverUrl: string, getToken: () => Promise(loadSettings()); +const initialSettings = loadSettings(); +let _settings = $state(initialSettings); // Backends are constructed once per page session. They're stateless // (or hold their own internal state in the case of BrowserBackend @@ -65,7 +66,7 @@ let _settings = $state(loadSettings()); const backends = [new BrowserBackend(), new ManaServerBackend(), new CloudBackend()]; export const llmOrchestrator = new LlmOrchestrator({ - settings: _settings, + settings: initialSettings, backends, }); diff --git a/packages/shared-ui/src/onboarding/create-app-onboarding.svelte.ts b/packages/shared-ui/src/onboarding/create-app-onboarding.svelte.ts index b3c01b238..3b97cec2f 100644 --- a/packages/shared-ui/src/onboarding/create-app-onboarding.svelte.ts +++ b/packages/shared-ui/src/onboarding/create-app-onboarding.svelte.ts @@ -42,21 +42,20 @@ const ONBOARDING_PREFERENCES_KEY = 'onboarding_preferences'; export function createAppOnboardingStore(config: AppOnboardingConfig): AppOnboardingStore { const { appId, steps, userSettings, onComplete, onSkip } = config; - // State - let currentStep = $state(0); - let preferences = $state({}); - let saving = $state(false); - let completed = $state(false); - - // Initialize preferences with default values + // Build initial preferences from step defaults before creating state + const initialPreferences: AppOnboardingPreferences = {}; for (const step of steps) { - if (step.type === 'select' && step.defaultValue !== undefined) { - preferences[step.id] = step.defaultValue; - } else if (step.type === 'toggle' && step.defaultValue !== undefined) { - preferences[step.id] = step.defaultValue; + if ((step.type === 'select' || step.type === 'toggle') && step.defaultValue !== undefined) { + initialPreferences[step.id] = step.defaultValue; } } + // State + let currentStep = $state(0); + let preferences = $state(initialPreferences); + let saving = $state(false); + let completed = $state(false); + // Derived values const totalSteps = $derived(steps.length); const isFirstStep = $derived(currentStep === 0); @@ -170,16 +169,7 @@ export function createAppOnboardingStore(config: AppOnboardingConfig): AppOnboar completed = false; currentStep = 0; - - // Reset preferences to defaults - preferences = {}; - for (const step of steps) { - if (step.type === 'select' && step.defaultValue !== undefined) { - preferences[step.id] = step.defaultValue; - } else if (step.type === 'toggle' && step.defaultValue !== undefined) { - preferences[step.id] = step.defaultValue; - } - } + preferences = { ...initialPreferences }; } finally { saving = false; } diff --git a/services/mana-media/apps/api/package.json b/services/mana-media/apps/api/package.json index bb7b4a5e6..6acb7fb3c 100644 --- a/services/mana-media/apps/api/package.json +++ b/services/mana-media/apps/api/package.json @@ -3,7 +3,7 @@ "version": "0.2.0", "private": true, "scripts": { - "dev": "bun run --watch src/index.ts", + "dev": "bun run --hot src/index.ts", "start": "bun run src/index.ts", "type-check": "tsc --noEmit", "db:push": "drizzle-kit push", diff --git a/services/mana-search/docker-compose.dev.yml b/services/mana-search/docker-compose.dev.yml index efbd90549..cae50e0e8 100644 --- a/services/mana-search/docker-compose.dev.yml +++ b/services/mana-search/docker-compose.dev.yml @@ -36,7 +36,7 @@ services: container_name: mana-search-redis-dev ports: - "6380:6379" # Different port to avoid conflicts - command: redis-server --appendonly yes --maxmemory 64mb --maxmemory-policy allkeys-lru + command: redis-server --appendonly yes --maxmemory 64mb --maxmemory-policy noeviction volumes: - redis-dev-data:/data networks: