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: