Skip to content

Commit 163e18d

Browse files
committed
fix(nitro): use regexp to strip query
1 parent e9cddf4 commit 163e18d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • packages/nitro-server/src/runtime/handlers

packages/nitro-server/src/runtime/handlers/island.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ const VALID_COMPONENT_NAME_RE = /^[a-z][\w.-]*$/i
116116

117117
async function getIslandContext (event: H3Event): Promise<NuxtIslandContext> {
118118
let url = event.path || ''
119-
if (import.meta.prerender && event.path && await islandPropCache!.hasItem(event.path)) {
119+
const islandPath = url.replace(/\?.*$/, '')
120+
if (import.meta.prerender && event.path && await islandPropCache!.hasItem(islandPath)) {
120121
// for prerender, the original request URL (with query) is rehydrated from cache
121122
// so that re-renders of the same island path use the original props
122-
url = await islandPropCache!.getItem(withoutQuery(event.path)) as string
123+
url = await islandPropCache!.getItem(islandPath) as string
123124
}
124125

125126
if (!url.startsWith(ISLAND_PATH_PREFIX)) {

0 commit comments

Comments
 (0)