Skip to content

Commit bc9ffa0

Browse files
committed
Fix siteURLData segment changing between page navigation
1 parent a5aa006 commit bc9ffa0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/gitbook-v2/src/middleware.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,14 @@ async function serveSiteRoutes(requestURL: URL, request: NextRequest) {
199199
routeType,
200200
mode,
201201
encodeURIComponent(siteURLWithoutProtocol),
202-
encodeURIComponent(rison.encode(siteURLData)),
202+
encodeURIComponent(
203+
rison.encode({
204+
...siteURLData,
205+
// The pathname is passed as the next segment of the route and should not cause this segment to change
206+
// based on the page being visited
207+
pathname: '<DO_NOT_USE>',
208+
})
209+
),
203210
pathname,
204211
].join('/');
205212

0 commit comments

Comments
 (0)