Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not sure if there are downsides to using
shallowRef
instead ofref
only on the server-side. As I understand it there's no reactivity on the server-side, so this shouldn't change much, besides not setting up reactivity tracking for nested keys?In my testing this fixes the messages from leaking when using computed translations after an async function in Nuxt. I can only guess that the reason for it is that the computed translation is referencing a key inside the object preventing it from being disposed. I don't think this fixes the root cause of the leak in
@nuxtjs/i18n
, but maybe lowers memory usage overall.I have also changed the
deepCopy
function to use iteration instead of recursion, which should lower memory usage as well.I have tested this with https://github.com/danielroe/i18n-memory-leak with the latest
@nuxtjs/i18n
and using dependency overrides forvue-i18n
andvue-i18n-core
with pnpm. I also used a modified locale file to also test nested keys (en.json). Unfortunately I wasn't able to run the e2e tests locally in WSL, I may have better luck on macos but haven't tried yet.Related