Skip to content

Front-end Performance Issues

Supporting Shortcut SC-8567 – Spike: Front-end performance improvements.

Performance issues identified in the control-rooms codebase, grouped by category. Each item describes which page or behavior triggers it and suggested mitigations.


Table of contents

  1. Overview
  2. Codebase validation
  3. HAR analysis
  4. Issue categories
  5. Related documents

1. Overview

Category Description
Duplicate API calls Same request made 2–46× when 1× would suffice
N+1 patterns One list fetch triggers N per-item fetches
Tab switch re-fetch Data re-loaded when switching tabs even though already in store
Console logging console.log in hot paths (production)
Render / lists Missing trackBy, virtual scroll for long lists

For detailed fix recommendations, see front-end-fix-analysis.md.


2. Codebase validation

Audit validated: March 2025 against control-rooms workspace.

Finding Location Status
Launchpad N+1 — getControlRooms() + per-room getControlRoomEventsImportanceSummary() control-rooms.service.ts (lines 52–79) ✅ Confirmed
Tab switch re-fetch — all three load effects fire on /map/ control-room.effects.ts, router.constants.ts ✅ Confirmed
Breadcrumb resolver — getControlRoom called directly control-room-breadcrumb.resolver.ts ✅ Confirmed
Form breadcrumb — getForm duplicated form-breadcrumb.resolver.ts, view-form-page.component.ts ✅ Confirmed
Console logging — 6× on ROUTER_NAVIGATED control-room.effects.ts ✅ Confirmed

3. HAR analysis

HAR analysis is split into separate files. Each documents API calls observed, duplicates, and suggested fixes for a specific user flow.

# Flow File
1 Launchpad initial load 01-launchpad-initial-load.md
2 Launchpad → Map/Assets 02-launchpad-map-assets-navigation.md
3 Launchpad → Event view 03-launchpad-event-view.md
4 Launchpad → Place view 04-launchpad-place-view.md
5 Asset view → Place view (tab switch) 05-asset-view-place-view-tab-switch.md
6 Open asset drawer 06-open-asset-drawer.md
7 Open place drawer 07-open-place-drawer.md
8 Control room Task page 08-control-room-task-page.md
9 Event report page 09-event-report-page.md
10 Event insights page 10-event-insights-page.md
11 Place insights page 11-place-insights-page.md
12 Asset insights page 12-asset-insights-page.md

4. Issue categories

4.1 Duplicate API calls — quick reference

Page or behavior Extra calls HAR reference
Launchpad 51 in ~2s (2× getControlRooms + 46× events/summary) 01
Launchpad → Map/Assets ~15 in first 3s 02
Launchpad → Event view ~45+ in first 5s 03
Launchpad → Place view ~35 in first 12s 04
Asset → Place tab switch ~10+ per switch 05
Open asset drawer 3× getCollaborators 06
Open place drawer 4× cycles/search (~1.8s each) 07
Task page 15 (10× count + 3× list + 2× collaborators) 08
Event report 2× CR, 2× collaborators; events/summary 13.4s 09
Event insights 2× collaborators, 2× cycles, 7× assets 10
Place insights ~15 redundant (5× cycles, 3× CR, etc.) 11
Asset insights 28–70+ (28× views, config/CR dupes) 12
Any CR page 2× getControlRoom (breadcrumb + app) —
Forms 2× getForm (breadcrumb + page) —

4.2 Console logging

  • Control room navigation: 6× console.log on every ROUTER_NAVIGATED
  • API services: console.log / console.warn in error handlers
  • Components: create-rule-form, task-drawer, event-type-filter, place-panel
  • Leaflet: console.warn for invalid bounds, center, etc.

Fix: Remove or gate behind isDevMode(); add lint rule for prod.

4.3 Render performance and lists

  • Many components use OnPush — good.
  • Some *ngFor / @for loops lack trackBy / track.
  • Long lists (events, assets, places) may benefit from virtual scrolling.

Files to audit: events-timeline.component.html, event-insights-events-list.component.html, place-table.component.html, asset-table.component.html.

4.4 Zoneless / manual change detection

  • Some components are not using ‘OnPush’ change detection, which may lead to unnecessary re-renders.

Document Purpose
front-end-fix-analysis.md Fix recommendations, implementation details, ticket reference for PMs
har-analysis/ Per-flow HAR analysis (12 files)