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

perf: favor importing generated options over passing as argument #2714

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

BobbieGoede
Copy link
Collaborator

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Instead of passing the generated nuxtI18nOptions as arguments, I instead import nuxtI18nOptions when needed or only pass the relevant properties instead of the full object.

Since most of the memory leaks so far have been related to the generated options, and we probably shouldn't mutate the generated options, this may reduce memory usage and reduce the odds of keeping a reference to the entire object in a closure. Maybe we could consider freezing the generated options to prevent any mutations, something to look into another time.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@BobbieGoede BobbieGoede requested a review from kazupon January 20, 2024 16:22
@BobbieGoede BobbieGoede self-assigned this Jan 20, 2024
@BobbieGoede BobbieGoede force-pushed the refactor/options-passing-2 branch from 169e128 to 94c6cae Compare January 21, 2024 15:17
Copy link
Collaborator

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! ❀️
Thanks!

@kazupon kazupon merged commit b396462 into nuxt-modules:main Jan 22, 2024
7 checks passed
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
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.

2 participants