Skip to content

Fix: Synchronous Watcher Issue Caused by Locale Setting Order #2104

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

Merged
merged 3 commits into from
Feb 9, 2025

Conversation

lcjnil
Copy link
Contributor

@lcjnil lcjnil commented Feb 8, 2025

reproduction: https://codesandbox.io/p/devbox/vue-i18n-9-template-forked-ffq44z

This PR adjusts the order of operations in the locale setter to rectify the issue where, during locale updates, a synchronous watcher may trigger after modifying the _locale.value (as seen in this file, but before updating the _context. This sequence led to errors because the translation mechanism relies exclusively on _context, not _locale.

Copy link

github-actions bot commented Feb 9, 2025

Size Report

Bundles

File Size Gzip Brotli
core.esm-browser.prod.js 37.16 kB 11.35 kB 10.12 kB
core.global.prod.js 30.50 kB 10.55 kB 9.52 kB
core.prod.cjs 0.88 kB 0.43 kB 0.34 kB
core.runtime.esm-browser.prod.js 22.87 kB 7.45 kB 6.65 kB
core.runtime.global.prod.js 17.48 kB 6.81 kB 6.12 kB
message-compiler.esm-browser.prod.js 19.28 kB 5.76 kB 5.14 kB
message-compiler.global.prod.js 17.32 kB 5.54 kB 4.97 kB
message-compiler.prod.cjs 57.50 kB 10.06 kB 8.60 kB
petite-vue-i18n-core.esm-browser.prod.js 20.35 kB (-0.01 kB) 6.84 kB (-0.00 kB) 6.15 kB (-0.00 kB)
petite-vue-i18n-core.global.prod.js 15.63 kB (-0.01 kB) 6.05 kB 5.47 kB (+0.00 kB)
petite-vue-i18n-core.prod.cjs 25.96 kB (-0.03 kB) 6.14 kB (-0.01 kB) 5.31 kB
petite-vue-i18n.esm-browser.prod.js 36.85 kB (-0.01 kB) 11.32 kB (-0.00 kB) 10.15 kB (-0.01 kB)
petite-vue-i18n.global.prod.js 29.85 kB (-0.01 kB) 10.18 kB 9.20 kB (+0.01 kB)
petite-vue-i18n.prod.cjs 25.64 kB (-0.03 kB) 6.05 kB (-0.00 kB) 5.24 kB (-0.01 kB)
petite-vue-i18n.runtime.esm-browser.prod.js 22.41 kB (-0.01 kB) 7.32 kB (-0.00 kB) 6.60 kB (-0.00 kB)
petite-vue-i18n.runtime.global.prod.js 16.85 kB (-0.01 kB) 6.41 kB (-0.00 kB) 5.80 kB (-0.00 kB)
vue-i18n.esm-browser.prod.js 56.42 kB (-0.01 kB) 16.42 kB (-0.00 kB) 14.68 kB (+0.01 kB)
vue-i18n.global.prod.js 46.04 kB (-0.01 kB) 14.87 kB (-0.00 kB) 13.37 kB (+0.00 kB)
vue-i18n.prod.cjs 0.72 kB 0.34 kB 0.28 kB
vue-i18n.runtime.esm-browser.prod.js 41.99 kB (-0.01 kB) 12.43 kB 11.21 kB (+0.06 kB)
vue-i18n.runtime.global.prod.js 33.03 kB (-0.01 kB) 11.13 kB (+0.00 kB) 10.05 kB (-0.02 kB)

Usages

Name Size Gzip Brotli
packages/size-check-core (@intlify/core) 9.10 kB 3.76 kB 3.41 kB
packages/size-check-petite-vue-i18n (petite-vue-i18n) 77.81 kB (-0.01 kB) 30.33 kB (+0.00 kB) 27.29 kB (+0.01 kB)
packages/size-check-vue-i18n (vue-i18n) 82.81 kB (-0.01 kB) 31.74 kB (-0.00 kB) 28.51 kB (-0.02 kB)

@kazupon kazupon added the Type: Bug Bug or Bug fixes label Feb 9, 2025
@kazupon kazupon changed the base branch from master to v11 February 9, 2025 04:29
@kazupon kazupon changed the base branch from v11 to master February 9, 2025 04:29
@kazupon
Copy link
Member

kazupon commented Feb 9, 2025

Thank you for your contribution!

The CI is not working correctly due to corepack issue.
I have pushed a commit to the master branch that fixes the issue.
If you pull in that commit, it should work correctly.
Would you please do that? 🙏

Copy link

pkg-pr-new bot commented Feb 9, 2025

Open in Stackblitz

@intlify/core

npm i https://pkg.pr.new/@intlify/core@2104

@intlify/core-base

npm i https://pkg.pr.new/@intlify/core-base@2104

@intlify/devtools-types

npm i https://pkg.pr.new/@intlify/devtools-types@2104

petite-vue-i18n

npm i https://pkg.pr.new/petite-vue-i18n@2104

@intlify/shared

npm i https://pkg.pr.new/@intlify/shared@2104

@intlify/message-compiler

npm i https://pkg.pr.new/@intlify/message-compiler@2104

vue-i18n

npm i https://pkg.pr.new/vue-i18n@2104

@intlify/vue-i18n-core

npm i https://pkg.pr.new/@intlify/vue-i18n-core@2104

commit: 0279572

@kazupon
Copy link
Member

kazupon commented Feb 9, 2025

never mind for my comment.

vue-i18n GitHub PR has just been able to update from branches.

CI results are all green :)
Thanks!

@kazupon kazupon merged commit 658efbf into intlify:master Feb 9, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants