-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Using the t method in computed will trigger a [Vue warn]: getCurrentInstance() called inside a computed getter. #2675
Comments
I'm having the same issue |
me too... |
Looks like this warning was added yesterday to Vue vuejs/core@324e817. Related discussion here vuejs/core#9974 ( I haven't looked into it yet, but I'm guessing the warning is triggered by something upstream in |
Seems like this line triggers the warning https://github.com/intlify/vue-i18n-next/blob/master/packages/vue-i18n-core/src/composer.ts#L1784 |
The warning has been reverted in Vue core, vuejs/core@2fd3905. I imagine there'll be a 3.4.7 soon to release that. |
Looks like the usage of As the warning has been removed and the usage shouldn't trigger the warning (usage is for debugging and done safely), I'll close this issue. And as mentioned this warning should be gone after the next Vue release! |
I supposed so. I'm using computed properties to easily react to lang switches in some components (i.e. the Navbar), I used this approach some time ago (about beta 10 iirc). I removed the computed properties to avoid the issue and it worked well, I guess that approach isn't needed anymore. |
Environment
Reproduction
https://stackblitz.com/edit/github-y149ef?file=app.vue
Describe the bug
As long as the t method is used in computed, this warning will appear.
Additional context
No response
Logs
[Vue warn]: getCurrentInstance() called inside a computed getter. This is incorrect usage as computed getters are not guaranteed to be executed with an active component instance. If you are using a composable inside a computed getter, move it ouside to the setup scope.
The text was updated successfully, but these errors were encountered: