Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: emulate event.platform during development even if route is undefined #12513

Merged
merged 8 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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` during development even if route is undefined
eltigerchino marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions packages/kit/src/runtime/server/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ export async function respond(request, options, manifest, state) {
}
}

if (!event.platform && DEV && state.emulator?.platform) {
yutak23 marked this conversation as resolved.
Show resolved Hide resolved
event.platform = await state.emulator.platform({ config: {}, prerender: false });
yutak23 marked this conversation as resolved.
Show resolved Hide resolved
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benmccann is this what you meant in #11996 (comment) ? I suppose one more check we need to add is if we're currently rendering a fallback


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