RadarHUD.update() throws if called before resize (undefined troika Text) #1073

Closed
opened 2026-08-13 13:29:09 +00:00 by spikerj · 1 comment
Owner

Where: projects/spikersoft/src/app/_components/_games/space-game/radar/radar-hud.ts — update() → updateTextDisplays() → syncTextIfChanged(this.modeText, …).

What: modeText / rangeText / … are only created in createUI(), which runs from resize(). updateScanLine() guards if (!this.scanLine) return, but the text path does not. Calling update() before the first resize() throws TypeError: Cannot read properties of undefined (reading 'text').

Repro (unit): new RadarHUD(mgr); hud.update(0.016);

Expected: no-op (or create UI lazily) until the viewport is known.

Found by Wave 8 a2 coverage tests.

**Where:** `projects/spikersoft/src/app/_components/_games/space-game/radar/radar-hud.ts` — `update()` → `updateTextDisplays()` → `syncTextIfChanged(this.modeText, …)`. **What:** `modeText` / `rangeText` / … are only created in `createUI()`, which runs from `resize()`. `updateScanLine()` guards `if (!this.scanLine) return`, but the text path does not. Calling `update()` before the first `resize()` throws `TypeError: Cannot read properties of undefined (reading 'text')`. **Repro (unit):** `new RadarHUD(mgr); hud.update(0.016);` **Expected:** no-op (or create UI lazily) until the viewport is known. Found by Wave 8 a2 coverage tests.
Author
Owner

Resolved in spikersoft-angular PR #819 (merged to master). RadarHUD.update() is safe if called before resize. Closing.

Resolved in spikersoft-angular [PR #819](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/819) (merged to `master`). RadarHUD.update() is safe if called before resize. Closing.
Sign in to join this conversation.