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

Error in 13.14.0: Expected a suspended thenable #1072

Closed
3 tasks done
jonathanwilke opened this issue May 17, 2024 · 5 comments
Closed
3 tasks done

Error in 13.14.0: Expected a suspended thenable #1072

jonathanwilke opened this issue May 17, 2024 · 5 comments
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@jonathanwilke
Copy link

Description

Hey,

when I upgrade next-intl to 13.14 in my Next app, I can't start my app anymore and it gives me the following error:

Bildschirmfoto 2024-05-17 um 16 22 51

Any idea what's wrong here? Is it a bug in the lib or is there a misconfiguration on my side?

Verifications

  • I've verified that the problem I'm experiencing isn't covered in the docs.
  • I've searched for similar, existing issues on GitHub and Stack Overflow.
  • I've compared my app to a working example to look for differences.

Mandatory reproduction URL

Reproduction description

Steps to reproduce:

  1. Open reproduction
  2. Click on …
  3. See error: …

Expected behaviour

No error

@jonathanwilke jonathanwilke added bug Something isn't working unconfirmed Needs triage. labels May 17, 2024
@amannn
Copy link
Owner

amannn commented May 18, 2024

Hey, is this from supastarter? Can you share a branch or PR with me where I can take a look?

@jonathanwilke
Copy link
Author

Yes it is. You can simply checkout main and install next-intl 13.14.0 and the error will occur on pnpm dev.

@amannn amannn changed the title Error in 13.14.0 Error in 13.14.0: Expected a suspended thenable May 18, 2024
@amannn
Copy link
Owner

amannn commented May 18, 2024

I've added a PR with a fix!

For others who come across this: The problem was that the root layout was async, but useLocale was called there. Apparently this has worked previously, but hooks should generally not be called in async components. React doesn't support this and as far as I know will also show an ESLint warning for this case in the future.

The fix was to use const locale = await getLocale() instead.

@hb20007
Copy link

hb20007 commented May 28, 2024

@amannn const locale = await getLocale() worked for me, but what do you mean that you added a PR with a fix? Isn't this something that needs to be fixed in the projects that are using next-intl while incorrectly using useLocale in async components?

@amannn
Copy link
Owner

amannn commented May 28, 2024

@hb20007 Yep, this needs to be fixed in app code. The "PR with a fix" was a PR of mine where I fixed the app code of the author of the bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

3 participants