Skip to content

Commit

Permalink
chore: remove unnecessary sortDynamicRoutes
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jul 8, 2024
1 parent ec07638 commit ba18e40
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions packages/react-server/src/features/router/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,9 @@ export function createFsRouteTree<T>(globEntries: Record<string, unknown>): {
}));
const tree = createTree(flatTree);

// TODO: this is not necessary anymore?
// sort to match static route first before dynamic route
sortDynamicRoutes(tree);

return { entries, tree };
}

function sortDynamicRoutes<T>(tree: TreeNode<T>) {
if (tree.children) {
tree.children = Object.fromEntries(
sortBy(Object.entries(tree.children), ([k]) => k.includes("[")),
);
for (const v of Object.values(tree.children)) {
sortDynamicRoutes(v);
}
}
}

export type MatchParamEntry = [key: string | null, value: string];
export type MatchParams = Record<string, string>;

Expand Down

0 comments on commit ba18e40

Please sign in to comment.