Skip to content

Commit 549f3f5

Browse files
DrJKLampcode-com
andcommitted
fix: remove duplicate api.init() from bootstrapStore
The websocket was being initialized before status event handlers were registered, causing the initial status message to be missed. Queue size showed 'X' instead of 0. api.init() is already called in app.ts addApiUpdateHandlers() after registering handlers. Amp-Thread-ID: https://ampcode.com/threads/T-019bf2db-6aa1-7210-aeed-f161486f950a Co-authored-by: Amp <amp@ampcode.com>
1 parent 3c81955 commit 549f3f5

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

src/stores/bootstrapStore.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('bootstrapStore', () => {
4545
expect(store.isI18nReady).toBe(false)
4646
})
4747

48-
it('starts early bootstrap (API and node defs)', async () => {
48+
it('starts early bootstrap (node defs)', async () => {
4949
const { api } = await import('@/scripts/api')
5050

5151
store.startEarlyBootstrap()
@@ -54,7 +54,6 @@ describe('bootstrapStore', () => {
5454
expect(store.isNodeDefsReady).toBe(true)
5555
})
5656

57-
expect(api.init).toHaveBeenCalled()
5857
expect(api.getNodeDefs).toHaveBeenCalled()
5958
})
6059

src/stores/bootstrapStore.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ import { api } from '@/scripts/api'
66
import { useUserStore } from '@/stores/userStore'
77

88
export const useBootstrapStore = defineStore('bootstrap', () => {
9-
const { execute: initApi } = useAsyncState(
10-
async () => {
11-
api.init()
12-
},
13-
undefined,
14-
{ immediate: false }
15-
)
16-
179
const {
1810
state: nodeDefs,
1911
isReady: isNodeDefsReady,
@@ -86,7 +78,6 @@ export const useBootstrapStore = defineStore('bootstrap', () => {
8678
}
8779

8880
function startEarlyBootstrap() {
89-
void initApi()
9081
void fetchNodeDefs()
9182
}
9283

0 commit comments

Comments
 (0)