Skip to content

Commit

Permalink
Refactor Server Router (#39902)
Browse files Browse the repository at this point in the history
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

This is intended to refactor the router code to reduce the overhead of executing routes. This is related to #32314 that may help reduce the memory overhead as this also replaced the `Set` with a `WeakMap`.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
wyattjoh and ijjk committed Aug 30, 2022
1 parent c89e25e commit 0b57a01
Show file tree
Hide file tree
Showing 2 changed files with 265 additions and 214 deletions.
1 change: 0 additions & 1 deletion packages/next/server/dev/next-dev-server.ts
Expand Up @@ -222,7 +222,6 @@ export default class DevServer extends Server {
for (const path in exportPathMap) {
const { page, query = {} } = exportPathMap[path]

// We use unshift so that we're sure the routes is defined before Next's default routes
this.router.addFsRoute({
match: getPathMatch(path),
type: 'route',
Expand Down

0 comments on commit 0b57a01

Please sign in to comment.