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

feat: i18n.locale property changes when route changed #129

Merged
merged 1 commit into from
Oct 6, 2018

Conversation

Yama-Tomo
Copy link

i18n.locale is reactive property. rerendered if it changed by using the switchLocalePath etc.

I think should that wait completed fetch or asyncData methods.

I modified the changes timing of locale property

@paulgv paulgv merged commit 66ba9f7 into nuxt-modules:master Oct 6, 2018
@magicknight
Copy link

This is not work on nuxt.js. when switch routhe, The locale is never changed. Only nextLocale changed.

@magicknight
Copy link

The previous version works fine. pls discard this commit

@paulgv
Copy link
Collaborator

paulgv commented Oct 12, 2018

Sorry about that, I just reverted the commit in v5.4.2
@Yama-Tomo any way you cou make another PR that doesn't impact previous behavior? Also if you could share a real-life use case for this change, it would be very much appreciated!

@Yama-Tomo
Copy link
Author

Not invoked app.i18n.onRouteChanged in plugins/main.js when route changes.. 🤔

@paulgv

real-life use case

  • Precondition
    top page fetch is slow to complete
  1. landing to EN top page
  2. go to JP top page via switchLocalePath link click
    2.1 changes locale property ---> re-render !!
    2.2 wait until fetch is completed
  3. JP top page rendered

This problem is time lag occurs between fetch completed and changes locale property.

I think that bad UX if it big

@Yama-Tomo
Copy link
Author

@magicknight Have you enabled the lazy option?

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

Successfully merging this pull request may close these issues.

None yet

3 participants