Skip to content

Commit

Permalink
fix: emulate event.platform even if route is undefined (#12513)
Browse files Browse the repository at this point in the history
* fix: in dev, emulate event.platform even if route is undefined

* chore: add .changeset

* Update .changeset/shiny-suns-scream.md

Co-authored-by: Tee Ming <chewteeming01@gmail.com>

* fix: suggest apply

Co-authored-by: Tee Ming <chewteeming01@gmail.com>

* fix: suggest apply

Co-authored-by: Tee Ming <chewteeming01@gmail.com>

* chore: format

* Update .changeset/shiny-suns-scream.md

---------

Co-authored-by: Tee Ming <chewteeming01@gmail.com>
  • Loading branch information
yutak23 and eltigerchino committed Sep 5, 2024
1 parent 5d1ce18 commit 109722c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-suns-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: emulate `event.platform` even when the route does not exist
5 changes: 5 additions & 0 deletions packages/kit/src/runtime/server/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ export async function respond(request, options, manifest, state) {
event.platform = await state.emulator.platform({ config, prerender });
}
}
} else if (state.emulator?.platform) {
event.platform = await state.emulator.platform({
config: {},
prerender: !!state.prerendering?.fallback
});
}

const { cookies, new_cookies, get_cookie_header, set_internal } = get_cookies(
Expand Down

0 comments on commit 109722c

Please sign in to comment.