Skip to content

Commit

Permalink
fix: correctly compare routes (#8952)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored Feb 9, 2023
1 parent 51cd6e6 commit 15c2777
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-chefs-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-netlify': patch
---

fix: correctly compare routes when generating split functions
7 changes: 4 additions & 3 deletions packages/adapter-netlify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ async function generate_lambda_functions({ builder, publish, split }) {

// figure out which lower priority routes should be considered fallbacks
for (let j = i + 1; j < builder.routes.length; j += 1) {
if (routes[j].prerender === true) continue;
const other = builder.routes[j];
if (other.prerender === true) continue;

if (matches(route.segments, routes[j].segments)) {
routes.push(builder.routes[j]);
if (matches(route.segments, other.segments)) {
routes.push(other);
}
}

Expand Down

0 comments on commit 15c2777

Please sign in to comment.