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

fix: common composable option passing #2737

Merged
merged 8 commits into from Jan 29, 2024

Conversation

BobbieGoede
Copy link
Collaborator

@BobbieGoede BobbieGoede commented Jan 27, 2024

πŸ”— 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

My changes to the composables made during the vue-i18n-routing integration PR broke composable usage in certain scenarios. I still need to add regression tests to prevent this from happening again.

The pattern used in vue-i18n-routing uses Reflect.apply to set these common options to this, I opted to pass the common options as arguments instead. Maybe this should be changed to prevent users from passing these options themselves? I changed my implementation, it now uses a function to wrap composables and provide the common options, this way the creation and passing of the options is not exposed to users.

πŸ“ Checklist

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

@BobbieGoede BobbieGoede self-assigned this Jan 27, 2024
@BobbieGoede BobbieGoede marked this pull request as ready for review January 27, 2024 15:19
@BobbieGoede BobbieGoede changed the title [WIP] fix: common composable option passing fix: common composable option passing Jan 27, 2024
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.

Good job!
Thanks!

@kazupon kazupon merged commit a94d606 into nuxt-modules:main Jan 29, 2024
7 checks passed
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
* fix: common composable option passing

* chore: fix composable JSDoc description

* refactor: remove unused code

* fix: `resolveRoute` should pass common options to `resolve`

* test: add regression tests for `nuxt-modules#2736`

* chore: add JSDoc description to `CommonComposableOptions`

* fix: provide composable options by wrapping

* refactor: head composable consistency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants