MCPcopy
hub / github.com/TanStack/router / findFlatMatch

Function findFlatMatch

packages/router-core/src/new-process-route-tree.ts:695–707  ·  view source on GitHub ↗
(
  /** The path to match. */
  path: string,
  /** The `processedTree` returned by the initial `processRouteTree` call. */
  processedTree: ProcessedTree<any, T, any>,
)

Source from the content-addressed store, hash-verified

693 * Take an arbitrary list of routes, create a tree from them (if it hasn't been created already), and match a path against it.
694 */
695export function findFlatMatch<T extends Extract<RouteLike, { from: string }>>(
696 /** The path to match. */
697 path: string,
698 /** The `processedTree` returned by the initial `processRouteTree` call. */
699 processedTree: ProcessedTree<any, T, any>,
700) {
701 path ||= '/'
702 const cached = processedTree.flatCache!.get(path)
703 if (cached) return cached
704 const result = findMatch(path, processedTree.masksTree!)
705 processedTree.flatCache!.set(path, result)
706 return result
707}
708
709/**
710 * @deprecated keep until v2 so that `router.matchRoute` can keep not caring about the actual route tree

Callers 2

buildWithMatchesMethod · 0.90

Calls 3

findMatchFunction · 0.85
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected