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

locales getting mixed on simultaneous requests #1219

Open
piyush96arora1 opened this issue Jul 10, 2024 · 4 comments
Open

locales getting mixed on simultaneous requests #1219

piyush96arora1 opened this issue Jul 10, 2024 · 4 comments

Comments

@piyush96arora1
Copy link

piyush96arora1 commented Jul 10, 2024

What version of this package are you using?
2.0.1

What operating system, Node.js, and npm version?
node 16.20.0
npm 8.19.4
next 13.4.19

What happened?
locales of pages getting mixed. This issue could be also replicated in demo project(next-vernac)clone git@github.com:aralroca/next-translate.git
Make a server component and add any promise to it as below
import useTranslation from "next-translate/useTranslation";

export default async function Title() {
const { t, lang } = useTranslation("common");
const res = await delay();
return (
<>

{t("title")}


</>
);
}

function delay() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(1);
}, 0.8);
});
}

Now call this title in page.js.

Simultaneously hit two locales of this page(localhost:3000 and localhost:3000/es) fastly. To hit 2 request at same time on local i did following
one request from browser and one using script, the lcoales will get mixed on english page spanish will be visible

What did you expect to happen?
The locales should remain same.

Are you willing to submit a pull request to fix this bug?
no

@cassus
Copy link

cassus commented Jul 18, 2024

Thanks for reporting! I just bumped into the same issue while playwright testing using concurrent workers.

I'm happy to provide more details if it helps to debug and fix this issue

@piyush96arora1
Copy link
Author

piyush96arora1 commented Sep 20, 2024

Any solution you found? Any updates? @cassus

@cassus
Copy link

cassus commented Sep 20, 2024

Hi, the workarounds I found was adding retries to our playwright tests or using the built version of our app to run the tests instead of the dev server

@piyush96arora1
Copy link
Author

Any one else faced?

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

No branches or pull requests

2 participants