From a4527a2faaea2ed4a5448ba301be9871a4cdba9e Mon Sep 17 00:00:00 2001 From: Sheraff Date: Sun, 16 Nov 2025 09:24:17 +0100 Subject: [PATCH] refactor(router-core): findSingleMatch caches the trees it generate in an LRUCache, not a Map --- packages/router-core/src/new-process-route-tree.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/router-core/src/new-process-route-tree.ts b/packages/router-core/src/new-process-route-tree.ts index e10be41c84..1df04461cc 100644 --- a/packages/router-core/src/new-process-route-tree.ts +++ b/packages/router-core/src/new-process-route-tree.ts @@ -535,7 +535,7 @@ export type ProcessedTree< /** a mini route tree generated from the flat `routeMasks` list */ masksTree: AnySegmentNode | null /** @deprecated keep until v2 so that `router.matchRoute` can keep not caring about the actual route tree */ - singleCache: Map> + singleCache: LRUCache> /** a cache of route matches from the `segmentTree` */ matchCache: LRUCache>> /** a cache of route matches from the `masksTree` */ @@ -675,7 +675,7 @@ export function processRouteTree< sortTreeNodes(segmentTree) const processedTree: ProcessedTree = { segmentTree, - singleCache: new Map(), + singleCache: createLRUCache>(1000), matchCache: createLRUCache< string, ReturnType>