-
Notifications
You must be signed in to change notification settings - Fork 93
Fix useModelMigration in async components #6608
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
base: stable8
Are you sure you want to change the base?
Fix useModelMigration in async components #6608
Conversation
It is a part of exposed Advanced API. It was called internal in the past indeed. Because it returns
Could you clarify on a case when it isn't supposed to work? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6608 +/- ##
==========================================
+ Coverage 42.50% 43.11% +0.60%
==========================================
Files 156 161 +5
Lines 4028 4108 +80
Branches 1036 1070 +34
==========================================
+ Hits 1712 1771 +59
- Misses 2200 2218 +18
- Partials 116 119 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2e98a83
to
85af9e5
Compare
I'm not actually sure, I think I read somewhere that it's only guaranteed to work from lifecycle events but setup is one, so I don't know why it wouldn't work in this situation. But I did observe it returning null so clearly it can happen (see the mentioned issue). Another thing, I just noticed that I forgot to update the jsdoc comment for useModelMigration, but I'm not sure how to type these two new parameters. (plus |
85af9e5
to
28495f8
Compare
And the setup function has the setup context. Otherwise not only this function wouldn't work here, but any composable and even reactive effect wouldn't be cleared after component is unmounted and etc.
I'd guess that you test not with installed In this case, you need to either use |
It was using getCurrentInstance() which, as I understand it, isn't part of vue's public API anymore and isn't guaranteed to work in every situation. Signed-off-by: Baltazár Radics <[email protected]>
28495f8
to
472f504
Compare
It was using getCurrentInstance() which, as I understand it, isn't part of vue's public API anymore and isn't guaranteed to work in every situation.
Makes call site a bit uglier, but I don't think there's a better way to do it.
☑️ Resolves
🏁 Checklist
next
requested with a Vue 3 upgrade