From 58b196c58310a1489b554d16ec2695c7974eaab3 Mon Sep 17 00:00:00 2001
From: Jarred Sumner <jarred@jarredsumner.com>
Date: Wed, 20 Oct 2021 04:18:29 -0700
Subject: rewrote most of the router

---
 packages/bun-framework-next/renderDocument.tsx | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'packages/bun-framework-next/renderDocument.tsx')

diff --git a/packages/bun-framework-next/renderDocument.tsx b/packages/bun-framework-next/renderDocument.tsx
index dfe80c3f7..aa6c85fbf 100644
--- a/packages/bun-framework-next/renderDocument.tsx
+++ b/packages/bun-framework-next/renderDocument.tsx
@@ -373,6 +373,7 @@ export async function render({
   DocumentNamespace = null,
   buildId,
   routePaths = [],
+  routeNames = [],
 }: {
   buildId: number;
   route: any;
@@ -382,6 +383,7 @@ export async function render({
   appStylesheets: string[];
   pageStylesheets: string[];
   routePaths: string[];
+  routeNames: string[];
   request: Request;
 }): Promise<Response> {
   const { default: Component, getStaticProps = null } = PageNamespace || {};
@@ -393,12 +395,10 @@ export async function render({
   var asPath = route.pathname;
   const pages = {};
 
-  for (let path of routePaths) {
-    const filePath = path.substring(
-      path.indexOf("_next/pages/") + "_next/pages".length
-    );
-    const name = filePath.substring(0, filePath.indexOf("."));
-    pages[name] = [Bun.origin + path];
+  for (let i = 0; i < routeNames.length; i++) {
+    const filePath = routePaths[i];
+    const name = routeNames[i];
+    pages[name] = [Bun.origin + filePath];
   }
 
   if (appStylesheets.length > 0) {
-- 
cgit v1.2.3

