-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: enhance locale handling with AsyncLocalStorage support for server-side requests #7826
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
base: build/v2
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: ef75798 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
@wmertens does it need a test?. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start but I think Core should not be influenced by Router.
packages/qwik-router/src/middleware/request-handler/user-response.ts
Outdated
Show resolved
Hide resolved
packages/qwik-router/src/middleware/request-handler/user-response.ts
Outdated
Show resolved
Hide resolved
packages/qwik-router/src/middleware/request-handler/user-response.ts
Outdated
Show resolved
Hide resolved
…al in use-locale.ts
@wmertens done .please check it again , thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :)
…improve code clarity
…al in use-locale.ts
@wmertens still need a global variable |
packages/qwik-router/src/middleware/request-handler/user-response.ts
Outdated
Show resolved
Hide resolved
@@ -420,7 +421,7 @@ export const serverQrl = <T extends ServerFunction>( | |||
|
|||
if (isServer) { | |||
// Running during SSR, we can call the function directly | |||
let requestEvent = globalThis.qcAsyncRequestStore?.getStore() as RequestEvent | undefined; | |||
let requestEvent = asyncRequestStore?.getStore() as RequestEvent | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you say it has to be a global for server-functions.ts, but it's not using the global?
…nd locale management
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that the current code will not update the async store tells me that we need a test for this. We should have an e2e test that requests the same route twice but with different locales, and with a promise in the middle of the page that gets resolved once both requests are being rendered.
packages/qwik-router/src/middleware/request-handler/async-request-store.ts
Outdated
Show resolved
Hide resolved
packages/qwik-router/src/middleware/request-handler/async-request-store.ts
Outdated
Show resolved
Hide resolved
…stStore initialization
… enhance code organization
feat: enhance locale handling with AsyncLocalStorage support for server-side requests
#7806
What is it?
Description
Checklist
pnpm change