fix(client): consume bootstrap handoff queue

This commit is contained in:
imccyu
2026-08-18 01:34:54 +08:00
parent 85bfc7bb22
commit 4ad6e28663
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ export class ClientModuleSystem implements ClientModuleLoader {
// Replace first: a bundle that executes while queued handoffs are draining
// must register against the live sink rather than append behind the drain.
win.__ModuleLoader__ = sink
for (const handoff of queued?.handoffs ?? []) sink.load(handoff)
for (const handoff of queued?.handoffs.splice(0) ?? []) sink.load(handoff)
}
/** Register one bundle factory, rejecting a script that executes twice without invalidation. */
@@ -72,6 +72,7 @@ describe('lazy CJS arrival', () => {
const b = bench([row('runtime')])
const exports = await b.loader.import('runtime', '', {})
expect((exports as { marker: string }).marker).toBe('preloaded')
expect(handoffs).toEqual([])
expect(b.fetched).toEqual([])
expect(win.__ModuleLoader__?.mode).toBe('live')
})