Commit Graph

25 Commits

Author SHA1 Message Date
Jordan Pittman
4172fdb90c
feat(reactivity): return array when calling toRefs on array (#1768)
close #1764
2020-08-18 12:11:13 -04:00
Pick
028a8c20df
test(reactivity): adjust ref unwrap test inside arrays (#1457) 2020-06-29 12:10:29 -04:00
蜗牛老湿
426803046f
test(reactivity): 100% reactivity coverage (#1299) 2020-06-11 16:55:56 -04:00
Evan You
2acf3e84b9 feat(reactivity): add triggerRef API
Also make shallowRef assignment behavior consistent with normal ref
2020-04-22 18:00:10 -04:00
Evan You
b0d4df9743 perf(reactivity): ref should not trigger if value did not change
Note: shallowRef will always trigger on assignment because it does not
account for deep mutations

close #1012
2020-04-22 15:11:01 -04:00
Carlos Rodrigues
d7ae1d0244
test(reactivity): add tests for object with symbols (#969) 2020-04-16 09:24:46 -04:00
Evan You
486dc188fe feat(reactivity): add support for toRef API 2020-04-14 20:49:18 -04:00
Evan You
b83c580131 feat(reactivity): add support for customRef API 2020-04-14 20:45:46 -04:00
Evan You
e9024bf1b7 feat(reactivity): expose unref and shallowRef 2020-02-22 04:39:32 +01:00
Evan You
775a7c2b41 refactor: preserve refs in reactive arrays
BREAKING CHANGE: reactive arrays no longer unwraps contained refs

    When reactive arrays contain refs, especially a mix of refs and
    plain values, Array prototype methods will fail to function
    properly - e.g. sort() or reverse() will overwrite the ref's value
    instead of moving it (see #737).

    Ensuring correct behavior for all possible Array methods while
    retaining the ref unwrapping behavior is exceedinly complicated; In
    addition, even if Vue handles the built-in methods internally, it
    would still break when the user attempts to use a 3rd party utility
    functioon (e.g. lodash) on a reactive array containing refs.

    After this commit, similar to other collection types like Map and
    Set, Arrays will no longer automatically unwrap contained refs.

    The usage of mixed refs and plain values in Arrays should be rare in
    practice. In cases where this is necessary, the user can create a
    computed property that performs the unwrapping.
2020-02-21 17:48:39 +01:00
hareku
014acc13e9
test(reactivity): test for ref without init value (#746) 2020-02-21 14:44:41 +01:00
Rustin
5aa9868512 test(reactivity): declare the exact type (#644) 2020-01-20 12:02:08 -05:00
Elad Frizi
1cf1ad5e94 test(reactivity): extracted repetitive assertions (#554) 2019-12-30 11:29:43 -05:00
Carlos Rodrigues
68ad302714 types(reactivity): add support for tuples in ref unwrapping (#436) 2019-11-08 12:52:24 -05:00
Carlos Rodrigues
c53ca29ea1 test(reactivity): Add check if the child array gets unwrap (#434) 2019-11-07 09:28:49 -05:00
扩散性百万甜面包
3cd2f7e68e types: fix ref unwrapping when nested inside arrays (#331) 2019-10-18 14:54:05 -04:00
相学长
cbb4b19cfb feat(reactivity): ref(Ref) should return Ref (#180) 2019-10-10 11:34:42 -04:00
Rahul Kadyan
f58e5e96f2 types: Use unique symbol type for _isRef property of ref object (#118) 2019-10-05 22:32:50 -04:00
Evan You
46bd9dbab0 perf: avoid using WeakSet for isRef check 2019-09-30 14:52:10 -04:00
Evan You
a0bc525fee test: test for isRef & toRefs 2019-08-26 18:17:02 -04:00
Evan You
e1bbfbba94 test: more test todos 2019-08-23 09:21:29 -04:00
Evan You
0aff144f93 wip: improve computed typing + test for setters 2019-08-21 12:01:05 -04:00
Evan You
aacad85058 test: fix reactivity tests 2019-08-20 09:58:10 -04:00
Evan You
96d65e1ab5 wip: improve ref typing 2019-08-16 09:54:57 -04:00
Evan You
caba6d5c9e wip: state -> reactive, value -> ref 2019-08-16 09:42:46 -04:00