Skip to content

Conversation

JerryWu1234
Copy link
Contributor

@JerryWu1234 JerryWu1234 commented Aug 15, 2025

feat: enhance locale handling with AsyncLocalStorage support for server-side requests

#7806

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests / types / typos
  • Infra

Description

Checklist

  • My code follows the developer guidelines of this project
  • I performed a self-review of my own code
  • I added a changeset with pnpm change
  • I made corresponding changes to the Qwik docs
  • I added new tests to cover the fix / functionality

Copy link

changeset-bot bot commented Aug 15, 2025

🦋 Changeset detected

Latest 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

@JerryWu1234 JerryWu1234 changed the title feat: enhance locale handling with AsyncLocalStorage support for serv… feat: enhance locale handling with AsyncLocalStorage support for server-side requests Aug 15, 2025
Copy link

pkg-pr-new bot commented Aug 15, 2025

Open in StackBlitz

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@7826
npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@7826
npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@7826
npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@7826

commit: ef75798

Copy link
Contributor

github-actions bot commented Aug 15, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview ef75798

@JerryWu1234 JerryWu1234 self-assigned this Aug 15, 2025
@JerryWu1234 JerryWu1234 marked this pull request as ready for review August 15, 2025 09:37
@JerryWu1234 JerryWu1234 requested a review from a team as a code owner August 15, 2025 09:37
@JerryWu1234
Copy link
Contributor Author

@wmertens does it need a test?.

Copy link
Member

@wmertens wmertens left a 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.

@JerryWu1234
Copy link
Contributor Author

@wmertens done .please check it again , thanks

@JerryWu1234 JerryWu1234 moved this from Backlog to Waiting For Review in Qwik Development Aug 19, 2025
Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

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

Almost there :)

@JerryWu1234
Copy link
Contributor Author

@wmertens still need a global variable qcAsyncRequestStore.
because in server-functions file can't read asyncRequestStore

@@ -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;
Copy link
Member

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?

Copy link
Member

@wmertens wmertens left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting For Review
Development

Successfully merging this pull request may close these issues.

2 participants