From a8bb39d5837e419949879c7c1c317f9947029873 Mon Sep 17 00:00:00 2001 From: hokiepokedad2 <38219945+hokiepokedad2@users.noreply.github.com> Date: Mon, 24 Aug 2026 19:06:17 -0400 Subject: [PATCH 1/3] fix(alarms): repaint alarm cards when species names arrive after the first render Pokemon, raid, nest and max battle lists resolve a species name through MasterDataService and paint before it has answered. The name maps were plain Maps, so nothing marked the views dirty when they filled: the cards kept the 'Pokemon #1' fallback until an unrelated redraw -- a route change -- happened along, which is why the second visit looked right. The four name maps are signals now. Every reader runs inside a template or a computed, so the read registers and the cards, the search box and the name-order sort all recover on their own. Quest lists reloaded inside the readiness callback and were already correct; gyms, lures, invasions, fort changes and Pokestop events resolve no species name at all. The spec flushes the responses after the first render, which is the only ordering that fails against the old code, and pairs it with the case where the names never arrive and the number must stay. --- .../services/masterdata-late-arrival.spec.ts | 98 +++++++++++++++++++ .../app/core/services/masterdata.service.ts | 61 +++++++----- CHANGELOG.md | 1 + 3 files changed, 137 insertions(+), 23 deletions(-) create mode 100644 Applications/Pgan.PoracleWebNet.App/ClientApp/src/app/core/services/masterdata-late-arrival.spec.ts diff --git a/Applications/Pgan.PoracleWebNet.App/ClientApp/src/app/core/services/masterdata-late-arrival.spec.ts b/Applications/Pgan.PoracleWebNet.App/ClientApp/src/app/core/services/masterdata-late-arrival.spec.ts new file mode 100644 index 00000000..6df06ced --- /dev/null +++ b/Applications/Pgan.PoracleWebNet.App/ClientApp/src/app/core/services/masterdata-late-arrival.spec.ts @@ -0,0 +1,98 @@ +import { provideHttpClient } from '@angular/common/http'; +import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; +import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; +import { TestBed } from '@angular/core/testing'; +import { provideTranslateService } from '@ngx-translate/core'; + +import { ConfigService } from './config.service'; +import { MasterDataService } from './masterdata.service'; + +/** + * Masterdata almost never wins the race against the first render: every alarm list paints its cards + * from the alarm rows, which come back first, and resolves each species name through + * `MasterDataService`. If the maps are not reactive, that first paint is also the last one and the + * cards keep the `Pokemon #1` fallback until something else happens to redraw them -- which is what + * a route change does, and why the names look right on the second visit. + * + * Every test here flushes the responses *after* the first read, because seeding the service first + * passes just as happily against the broken code. + */ +@Component({ + changeDetection: ChangeDetectionStrategy.OnPush, + selector: 'app-masterdata-host', + standalone: true, + template: '
{{ 'QUESTS.SELECTION_COUNT' | translate: { count: selectedPokemonIds().length } }}
+ +{{ 'QUESTS.SELECTION_COUNT' | translate: { count: selectedMegaPokemonIds().length } }}
- } -{{ 'QUESTS.SELECTION_COUNT' | translate: { count: selectedCandyPokemonIds().length } }}
- } -{{ 'QUESTS.SELECTION_COUNT' | translate: { count: selectedPokemonIds().length } }}
+ } + } + @case (1) { +{{ 'QUESTS.SELECTION_COUNT' | translate: { count: selectedMegaPokemonIds().length } }}
+ } +{{ 'QUESTS.SELECTION_COUNT' | translate: { count: selectedCandyPokemonIds().length } }}
+ } +