-
Notifications
You must be signed in to change notification settings - Fork 345
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
feat: adding missing reactivity api from vue-next #311
Conversation
implementation is wrong, but it just to have something kinda working, suggestions and help is welcome :)
# Conflicts: # src/apis/state.ts # src/reactivity/index.ts # src/reactivity/ref.ts
# Conflicts: # src/apis/inject.ts # src/reactivity/ref.ts
…nt' into feat/vue3_API # Conflicts: # test/apis/watch.spec.js
Vue2 Limitations
This looks like great work! I'll need a bit more time to properly review this. I'm on it tough! |
So I have done a review.
So from my perspective this looks fine! |
I tried not to make too many changes to the current tests, focused more on porting the tests from Hopefully this types will improve, and they were basically copy&paste from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let me know when you feel it's ready, I think I am able to help with merging.
I also notice this already covered #300. I will close it in favor of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to have some uncaptured warnings for npm test
which I think should make the tests failed but it didn't. https://github.com/vuejs/composition-api/pull/311/checks?check_run_id=723085160 I will try to investigate a bit.
EDIT: made a PR pikax#2
@antfu sorry missed your comment, didn't noticed the errors! Thank you |
expect(fn).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
// it('onBeforeUnmount', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment this test because couldn't make this work, this was brought from vue-next
not sure if we should fix this
// expect(fn).toHaveBeenCalledTimes(1); | ||
// }); | ||
|
||
// it('onUnmounted', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and let's get it merged! Thanks for the great work!
This plugin is falling behind on the reactivity API
This PR is aimed to make the reactivity API close as possible to vue-next.
Current problems
effect
not portedreadonly
not portedmakeRaw
this is quite cheat, since the original object gets change, having this doesn't do muchreactive([])
- because of the v2 reactivity system arrays cannot be reactive, should be warn?Breaking
Added
shallowReactive
shallowRef
Changes
reactive
marks all possible objects as reactive to conform to vue 3set
marks reactive