fix: critical storage init - AppStorage constructed with wrong args
Some checks are pending
CI / build-check-test (push) Waiting to run
Some checks are pending
CI / build-check-test (push) Waiting to run
ROOT CAUSE: setAppStorage(new AppStorage(backend)) passed 1 arg to a 5-arg constructor (settings, providerKeys, sessions, customProviders, backend). This left providerKeys=undefined, crashing sendMessage() at AgentInterface.ts:223 every time. Fix: - Create all Store instances first - Create IndexedDBStorageBackend with proper config (dbName, stores) - Wire backend into each store via setBackend() - Construct AppStorage with all 5 required arguments This was the root cause of all "messages wont send" bugs.
This commit is contained in:
parent
d8dc140252
commit
aca28ad0ec
1 changed files with 23 additions and 3 deletions
|
|
@ -71,13 +71,33 @@ import "./components/typing-indicator.js";
|
|||
import "./components/context-peek.js";
|
||||
|
||||
// ===== STORAGE =====
|
||||
const backend = new IndexedDBStorageBackend();
|
||||
setAppStorage(new AppStorage(backend));
|
||||
const sessionsStore = new SessionsStore();
|
||||
// 1. Create all stores first (to collect their configs)
|
||||
const settingsStore = new SettingsStore();
|
||||
const providerKeysStore = new ProviderKeysStore();
|
||||
const sessionsStore = new SessionsStore();
|
||||
const customProvidersStore = new CustomProvidersStore();
|
||||
|
||||
// 2. Create IndexedDB backend with all store configs
|
||||
const backend = new IndexedDBStorageBackend({
|
||||
dbName: "jae-web-ui",
|
||||
version: 1,
|
||||
stores: [
|
||||
settingsStore.getConfig(),
|
||||
providerKeysStore.getConfig(),
|
||||
sessionsStore.getConfig(),
|
||||
customProvidersStore.getConfig(),
|
||||
],
|
||||
});
|
||||
|
||||
// 3. Wire backend into each store
|
||||
settingsStore.setBackend(backend);
|
||||
providerKeysStore.setBackend(backend);
|
||||
sessionsStore.setBackend(backend);
|
||||
customProvidersStore.setBackend(backend);
|
||||
|
||||
// 4. Create and register global AppStorage with ALL required args
|
||||
setAppStorage(new AppStorage(settingsStore, providerKeysStore, sessionsStore, customProvidersStore, backend));
|
||||
|
||||
// ===== STATE =====
|
||||
let chatPanel: ChatPanel;
|
||||
let agent: Agent | null = null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue