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
Evan You
627b9df4a2
fix(types): improve ref typing, close #759
2020-02-21 17:45:42 +01:00
Evan You
33622d6360
perf(reactivity): only trigger all effects on Array length mutation if new length is shorter than old length
2020-02-21 15:05:16 +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
Evan You
2fb7a63943
fix(computed): support arrow function usage for computed option
...
fix #733
2020-02-17 23:22:25 -05:00
Evan You
d9d63f21b1
fix(reactivity): avoid cross-component dependency leaks in setup()
2020-02-17 23:14:07 -05:00
jods
8874b21a7e
perf(reactivity): better computed tracking ( #710 )
2020-02-09 15:25:17 -05:00
Dmitry Sharshakov
7f38c1e0ff
feat(reactivity): add shallowReactive function ( #689 )
2020-02-04 10:15:27 -05:00
Evan You
763faac182
wip(ssr): revert reactivity ssr paths
...
The perf gains are not worth the correctness issues these paths may lead to
2020-01-27 16:00:18 -05:00
Evan You
e43f5935b5
refactor: better variable naming
2020-01-27 16:00:18 -05:00
Evan You
25a0d4a65f
wip(ssr): reduce reactivity overhead during ssr
2020-01-27 16:00:17 -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
likui
0c42a6d8fa
types: refactor ref unwrapping ( #646 )
2020-01-20 13:22:18 -05:00
IU
2b4d0d6501
types(reactivity): handle primitive + object intersection types in UnwrapRef ( #614 )
2020-01-16 17:47:47 -05:00
likui
63a6563106
fix(reactivity): should delete observe value ( #598 )
...
fix #597
2020-01-13 17:11:49 -05:00
Carlos Rodrigues
985f4c91d9
types: improve isRef typing ( #578 )
2020-01-06 16:15:49 -05:00
Evan You
755c7b581c
chore: mark get/set create calls pure
2019-12-20 11:16:46 -05:00
Evan You
0a4f306492
fix: shallowReadonly should keep reactive properties reactive
...
ref #552
2019-12-20 11:14:07 -05:00
Evan You
46c5393224
perf(reactivity): optimize effect stack
2019-12-13 23:06:55 -05:00
ztplz
02478b48eb
chore: use const instead of let ( #524 )
2019-12-06 00:10:06 +01: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
ztplz
2d40466d35
chore: remove unused parameter type definitions ( #481 )
2019-11-22 15:35:58 -05:00
Evan You
61d8941692
types(reactivity): ref type should not expose _isRef
2019-11-08 13: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
QuincyChen
d7d87622ce
refactor: use isArray function from shared ( #441 )
2019-11-08 09:52:24 -05:00
Evan You
d9c6ff372c
feat(core): allow passing explicit refs via props
2019-11-06 12:51:26 -05:00
Junyan
a02820d7e0
feat: warn when toRefs() receives non-reactive object ( #430 )
2019-11-05 10:44:28 -05:00
Evan You
f3c1fa75f6
feat(reactivity): provide correct tracking info for refs
2019-11-02 23:20:49 -04:00
Evan You
66ecd8b47f
types: setup tests for built d.ts files
2019-11-01 22:54:01 -04:00
Evan You
247c53672d
refactor(reactivity): simplify effect options
2019-10-30 11:11:23 -04:00
Junyan
d76cfba7fb
refactor(reactivity): reduce code of type check ( #377 )
2019-10-25 11:15:04 -04:00
相学长
abfb2ec8ed
types(reactivity): computed types remove as
( #367 )
2019-10-24 11:37:52 -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
590e4e0ba9
chore: fix DebuggerEvent export
2019-10-22 11:53:32 -04:00
Evan You
af57ad110f
chore: revert prettier
2019-10-22 11:53:32 -04:00
Evan You
b5886189ba
types: massive refactor
2019-10-22 11:53:32 -04:00
Dmitry Sharshakov
74d8c5919d
types: improve computed types ( #343 )
2019-10-21 13:57:20 -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
edison
60961ef5b6
perf(reactivity): optimize the performance of the canObserve
( #330 )
2019-10-18 12:11:58 -04:00
Evan You
e3b68972d8
perf: minor tweaks
2019-10-17 15:02:15 -04:00
Evan You
cdee65aa1b
perf: revert to _isRef for perf
...
Benchmarking shows checking for a plain property is about 4~5x faster
than checking for a Symbol, likely because the Symbol does not fit well
into V8's hidden class model.
2019-10-17 15:02:14 -04:00
Tidyzq
a72652f6e6
refactor(reactivity): immediate return ( #301 )
2019-10-16 01:58:11 -04:00
edison
b5209277de
refactor(reactivity): define hadKey if necessary ( #288 )
2019-10-15 11:59:40 -04:00
夜宴
9a37c4b2c3
refactor(effect): use includes instead of indexOf ( #286 )
2019-10-15 11:18:26 -04:00
Evan You
1c56d1bf19
test: test unwrapping computed refs
2019-10-14 11:21:09 -04:00
Jooger
d8b2b9eb9c
types(ref): improve UnwrapRef types ( #266 )
2019-10-14 11:02:49 -04:00
Jooger
675ce2c15d
types(reactivity): fix ref typing ( #239 )
2019-10-12 11:05:34 -04:00
Chester
e68321eac0
chore: use '' instead of undefined ( #205 )
2019-10-11 22:04:33 -04:00
相学长
cbb4b19cfb
feat(reactivity): ref(Ref) should return Ref ( #180 )
2019-10-10 11:34:42 -04:00
扩散性百万甜面包
def27239bd
type: improve typing ( #177 )
2019-10-09 14:01:53 -04:00
Evan You
8f1475b8dd
refactor(reactivity): use NOOP for readonly computed setter in production
2019-10-09 12:22:08 -04:00
Dmitry Sharshakov
530be302fc
feat(computed): warn if trying to set a readonly computed ( #161 )
2019-10-09 12:20:53 -04:00
terencez
dadfb27eed
refactor(reactivity): prefer to use effect symbol and add isEffect() ( #169 )
2019-10-09 12:16:29 -04:00
terencez
ff68db46ea
fix(reactivity): avoid triggering effect when deleting property returns false ( #168 )
2019-10-09 11:55:57 -04:00
Cr
b9a4d8d088
refactor(reactivity): use function isSymbol instead of typeof ( #155 )
2019-10-09 11:49:23 -04:00
扩散性百万甜面包
80e5b16f99
types: improve type 'ReactiveEffect' with generics ( #99 )
2019-10-08 13:48:13 -04:00
Andrew / Kana
c6b7afcc23
types: use recursion for unwrapping refs ( #137 )
2019-10-06 20:11:52 -04:00
Carlos Rodrigues
8d70093802
refactor(reactivity): change _isRef to use refSymbol as key ( #124 )
2019-10-06 11:46:08 -04:00
月迷津渡
5eacfaf210
fix(reactivity): explicitly do type conversions in warning strings ( #129 )
2019-10-06 11:26:33 -04:00
Carlos Rodrigues
3d975247cd
types: cleanup some unnecessary typing in reactivity ( #126 )
2019-10-06 11:22:32 -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
扩散性百万甜面包
caa9297da6
refactor: move writable check out of computed setter ( #112 )
2019-10-05 15:48:05 -04:00
扩散性百万甜面包
0bdee72e17
feat(reactivity): use Symbol for Ref._isRef ( #114 )
2019-10-05 15:46:36 -04:00
扩散性百万甜面包
842f235ede
chore: fix typo ( #108 )
2019-10-05 15:39:47 -04:00
Carlos Rodrigues
fbabae0c0a
chore: replace some type casts and fix variable and filename typos ( #93 )
2019-10-05 10:38:02 -04:00
扩散性百万甜面包
5c1e42f754
types: improve type 'Ref' ( #105 )
2019-10-05 10:10:37 -04:00
Evan You
46bd9dbab0
perf: avoid using WeakSet for isRef check
2019-09-30 14:52:10 -04:00
Evan You
b3b67b8c7d
feat(compiler): ensure interpolation expressions are wrapped with toString()
2019-09-23 15:36:30 -04:00
Evan You
360f3b4f37
types: improve type exports
2019-09-06 12:58:31 -04:00
Evan You
891f21b010
refactor: extract hasOwn helper
2019-09-05 20:48:14 -04:00
Evan You
6c7cbb0dc9
types: avoid plain objects with value being mistaken as refs
2019-09-05 18:32:19 -04:00
Evan You
9b90e673e8
wip: improve options typing
2019-09-05 16:09:30 -04:00
Evan You
a6de6daa17
wip: disable tracking in all hooks
2019-09-04 18:20:47 -04:00
Evan You
a6616e4210
feat: 2.x options support
2019-09-03 22:25:38 -04:00
Evan You
7ecdc79d5e
test: finish tests for watch api
2019-08-27 11:35:22 -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
daf67397ae
wip: pass attrs fallthrough tests
2019-08-22 22:07:51 -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
0519e10518
wip: make computed implementation consistent
2019-08-20 09:45:28 -04:00
Evan You
b218678c66
feat: toRefs
2019-08-20 09:38:00 -04:00
Evan You
e53874f7e7
fix: reactive and immutable should warn for undefined
2019-08-19 15:01:50 -04:00
Evan You
6a22ad2fb2
types: simplify ref type
2019-08-18 22:48:46 -04:00
Evan You
3facfa5a55
wip: adjust computed ref type
2019-08-16 10:52:45 -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
09141b56fd
wip: proper handling of value assignment in reactive object
2019-08-13 11:30:28 -04:00
Evan You
2fc0d599db
revert: "wip: handle value -> value assignment in reactive object"
...
This reverts commit 61ab483af1
.
2019-08-13 11:27:48 -04:00
Evan You
61ab483af1
wip: handle value -> value assignment in reactive object
2019-08-13 11:13:26 -04:00
Evan You
bfe6987323
refactor: adjust reactivity structure
2019-06-12 00:03:50 +08:00
Evan You
471899af8b
refactor: rename reactivity package name and APIs
2019-06-11 23:50:28 +08:00