Removed context.root
from every component
#256
Merged
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.
As we have said, 2025 is going to be the focus for moving away from Vue 2 to Vue 3. This task is tremendous, but we can always do small bits.
I have removed
context.root
calls and move it away from context to different places, so once we move to vue 3, we just need to change the import.Here are the key changes
useRouter & useRoute
Before my PR
After my PR
How does
useRouter
work under-the-hood?In
app.vue
we provide thecontext.root.router
to the app.Then inside
useRouter
we just use inject it.After Vue 3
useI18n
Before my PR
After my PR
How does
useI18n
work under-the-hood?In
app.vue
we provide thecontext.root.$i18n
to the app.Then inside
useI18n
we just use inject it.Next Tick
Before my PR
My PR
Vue 3!
Once we move to vue 3 will become (if we decide to not use auto-imports 😉)
Missing
context
definitionsWe still need to use
context
to definerefs
andemit
, which I am not aware that we do a similar approach to ease the transition to vue 3. If you have an idea, please let me know.