diff --git a/src/router/trie-router/node.ts b/src/router/trie-router/node.ts index 1efe89d2..94ab4de1 100644 --- a/src/router/trie-router/node.ts +++ b/src/router/trie-router/node.ts @@ -198,10 +198,13 @@ export class Node { curNodes = tempNodes } - const results = handlerSets.sort((a, b) => { - return a.score - b.score - }) - return [results.map(({ handler, params }) => [handler, params] as [T, Params])] + if (handlerSets.length > 1) { + handlerSets.sort((a, b) => { + return a.score - b.score + }) + } + + return [handlerSets.map(({ handler, params }) => [handler, params] as [T, Params])] } }