Space-game KeybindingConfigHUD is constructed twice; needsPrompt dialog can be discarded #1099

Closed
opened 2026-08-13 14:23:14 +00:00 by spikerj · 1 comment
Owner

Wave 8 tick 3 leftover coverage of space-game.component.ts initHUD (lines 1052–1068).

KeybindingManager.loadKeybindings() and the regular import("./hud") both construct KeybindingConfigHUD. If needsPrompt resolves first, leftover lines 1057–1058 create HUD A and call showBackendLoadDialog(). The later regular import then does this.keybindingConfigHUD = new KeybindingConfigHUD() and overwrites A, so the backend-load dialog is never visible.

The inverse race (regular import first) is the common path and works. The leftover constructor exists only for the losing race, and even then the second assignment can discard it.

Characterization: space-game.component.init.spec.ts — "constructs KeybindingConfigHUD in the needsPrompt race when the regular import has not landed".

Fix: construct the HUD once (await the dynamic import, then ??= / guard), then show the dialog on that instance.

Wave 8 tick 3 leftover coverage of `space-game.component.ts` `initHUD` (lines 1052–1068). `KeybindingManager.loadKeybindings()` and the regular `import("./hud")` both construct `KeybindingConfigHUD`. If `needsPrompt` resolves first, leftover lines 1057–1058 create HUD A and call `showBackendLoadDialog()`. The later regular import then does `this.keybindingConfigHUD = new KeybindingConfigHUD()` and **overwrites** A, so the backend-load dialog is never visible. The inverse race (regular import first) is the common path and works. The leftover constructor exists only for the losing race, and even then the second assignment can discard it. Characterization: `space-game.component.init.spec.ts` — "constructs KeybindingConfigHUD in the needsPrompt race when the regular import has not landed". Fix: construct the HUD once (await the dynamic import, then `??=` / guard), then show the dialog on that instance.
Author
Owner

Fixed in spikersoft-angular PR #823 (a0f0ccd9). Closing.

Fixed in `spikersoft-angular` [PR #823](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/823) (`a0f0ccd9`). Closing.
Sign in to join this conversation.