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
guaijie
5fac65589b
fix(reactivity): should trigger all effects when array length is mutated ( #754 )
2020-02-21 11:38:07 +01:00
Evan You
e8e67729cb
fix(reactivity): effect should handle self dependency mutations
2020-02-18 13:22:09 -05:00
Evan You
e1c9153b9e
fix(reactivity): trigger iteration effect on Map.set
...
fix #709
2020-02-18 00:09:24 -05:00
Dmitry Sharshakov
7f38c1e0ff
feat(reactivity): add shallowReactive function ( #689 )
2020-02-04 10:15:27 -05:00
Evan You
aefb7d282e
fix(reactivity): Array methods relying on identity should work with raw values
2020-01-23 13:42:31 -05:00
Evan You
2569890e31
refactor: move mockWarn utility to @vue/shared
...
close #652
2020-01-22 09:29:45 -05:00
Rustin
5aa9868512
test(reactivity): declare the exact type ( #644 )
2020-01-20 12:02:08 -05:00
likui
63a6563106
fix(reactivity): should delete observe value ( #598 )
...
fix #597
2020-01-13 17:11:49 -05:00
Elad Frizi
1cf1ad5e94
test(reactivity): extracted repetitive assertions ( #554 )
2019-12-30 11:29:43 -05:00
Evan You
0a4f306492
fix: shallowReadonly should keep reactive properties reactive
...
ref #552
2019-12-20 11:14:07 -05:00
Evan You
89a187b895
refactor(reactivity): separate track and trigger operation types
2019-12-03 11:30:24 -05:00
Evan You
57bbbb227c
fix(core): propsProxy should not convert non-reactive nested values
2019-12-02 14:11:12 -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
Evan You
d9c6ff372c
feat(core): allow passing explicit refs via props
2019-11-06 12:51:26 -05:00
JiZhi
cb97d152b8
test(effect): add test for nested stopped effect ( #417 )
2019-10-30 11:36:17 -04:00
Evan You
247c53672d
refactor(reactivity): simplify effect options
2019-10-30 11:11:23 -04:00
夜宴
57276f9dcb
test(effect): add test for json methods ( #371 )
2019-10-25 10:17:31 -04:00
Mayness
18a349ce8c
fix(reactivity): account for NaN in value change checks ( #361 )
2019-10-23 11:53:43 -04:00
Cr
246cad7459
fix(reactivity): Map.set should trigger when adding new entry with undefined value ( #364 )
2019-10-23 11:00:55 -04:00
Evan You
d69d3bf765
fix(reactivity): revert to Reflect.get and add test cases
2019-10-18 15:31:28 -04:00
扩散性百万甜面包
3cd2f7e68e
types: fix ref unwrapping when nested inside arrays ( #331 )
2019-10-18 14:54:05 -04:00
Evan You
1c56d1bf19
test: test unwrapping computed refs
2019-10-14 11:21:09 -04:00
相学长
cbb4b19cfb
feat(reactivity): ref(Ref) should return Ref ( #180 )
2019-10-10 11:34:42 -04:00
唐道海
b7b89505eb
test(reactivity/effect): add test for lazy option ( #179 )
2019-10-10 10:12:27 -04:00
Dmitry Sharshakov
530be302fc
feat(computed): warn if trying to set a readonly computed ( #161 )
2019-10-09 12:20:53 -04:00
夜宴
8d10096d24
test(reactivity): check for key in entries iteration ( #152 )
2019-10-08 11:00:20 -04:00
Alexander Zibert
4605f43b95
test(reactivity): fixed small copy & paste error ( #140 )
2019-10-06 20:18:47 -04:00
月迷津渡
5eacfaf210
fix(reactivity): explicitly do type conversions in warning strings ( #129 )
2019-10-06 11:26:33 -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
Vladimir
f48a2ffc76
chore: fix typos ( #103 )
2019-10-05 10:48:54 -04:00
Carlos Rodrigues
600ec5de42
chore: improve typings in reactivity tests ( #96 )
2019-10-05 10:39:40 -04:00
Evan You
46bd9dbab0
perf: avoid using WeakSet for isRef check
2019-09-30 14:52:10 -04:00
Evan You
98d1406214
test: test for app-level APIs
2019-09-03 18:11:04 -04:00
Evan You
62e07a1b7e
test: coverage
2019-08-27 14:42:05 -04:00
Evan You
7ecdc79d5e
test: finish tests for watch api
2019-08-27 11:35:22 -04:00
Evan You
cb3866890f
test: effect.onStop
2019-08-26 21:24:44 -04:00
Evan You
a0bc525fee
test: test for isRef & toRefs
2019-08-26 18:17:02 -04:00
Evan You
3efe0ba3cd
test: jest warning assert utils
2019-08-26 16:08:23 -04:00
Evan You
589d3c2feb
refactor: immutable -> readonly
2019-08-23 09:38:32 -04:00
Evan You
e1bbfbba94
test: more test todos
2019-08-23 09:21:29 -04:00
Evan You
2777cd37b4
test: test immutable + ref
2019-08-21 12:03:35 -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
Evan You
bfe6987323
refactor: adjust reactivity structure
2019-06-12 00:03:50 +08:00