From 717915d54008fa999c3a6008da7ebdecf5f56f61 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 20 Oct 2026 03:21:11 +0000 Subject: [PATCH] fix(maps): read the index terms when a row is judged, not when the module loads (PLN-02) A suite that stubs the places index client without its term table could no longer load the maps service, because the list of every term was built when the module was first imported. It is read where a row is judged now. --- server/src/nest/maps/maps-index.helpers.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/src/nest/maps/maps-index.helpers.ts b/server/src/nest/maps/maps-index.helpers.ts index 9afb529c6..3c031d63f 100644 --- a/server/src/nest/maps/maps-index.helpers.ts +++ b/server/src/nest/maps/maps-index.helpers.ts @@ -151,9 +151,6 @@ export function indexRequestsPerKind(plan: IndexPoiPlan): IndexRequest[] { ); } -/** Every term the index is asked by, whichever kind asks for it. */ -const EVERY_TERM = Object.values(POI_CATEGORY_TO_TREK).flat(); - /** * Whether a row's most specific known term is one an asked kind asks for. A * water park lies under the parks' path, but `activity` names its own path for @@ -165,7 +162,9 @@ export function ownedByAsked( row: { category: string | null; categoryPath: string | null }, asked: readonly string[], ): boolean { - const term = indexRowTerm(EVERY_TERM, row.category, row.categoryPath); + // Every term the index is asked by, whichever kind asks for it; read here, not + // when the module loads, so a suite that stubs the index client stays loadable. + const term = indexRowTerm(Object.values(POI_CATEGORY_TO_TREK).flat(), row.category, row.categoryPath); return term === undefined || asked.some((kind) => POI_CATEGORY_TO_TREK[kind]?.includes(term)); }