Commit Graph

218 Commits

Author SHA1 Message Date
Carlos Rodrigues
70b55d797f
Apply suggestions from code review
Co-Authored-By: Evan You <yyx990803@gmail.com>
2020-04-15 16:07:07 +01:00
pikax
dcb5985c00 Merge remote-tracking branch 'github/master' into changing_unwrap_ref 2020-04-15 15:54:26 +01:00
Evan You
3178504273 refactor(reactivity): make readonly non-tracking 2020-04-14 23:49:46 -04:00
Evan You
09b44e07cb refactor(reactivity): move array ref handling into getter 2020-04-14 22:18:58 -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
78977c3997 fix(scheduler): sort jobs before flushing
This fixes the case where a child component is added to the queue before
its parent, but should be invalidated by its parent's update. Same logic
was present in Vue 2.

Properly fixes #910
ref: https://github.com/vuejs/vue-next/issues/910#issuecomment-613097539
2020-04-14 17:31:35 -04:00
Evan You
e8a866ec99 refactor(reactivity): remove stale API markReadonly
BREAKING CHANGE: `markReadonly` has been removed.
2020-04-13 17:39:48 -04:00
pikax
6a66b7b60a Merge remote-tracking branch 'github/master' into changing_unwrap_ref 2020-04-13 18:32:14 +01:00
Thorsten Lünborg
33ccfc0a8b
fix(types): UnwrapRef should bail on DOM element types (#952)
fix #951
2020-04-13 11:51:32 -04:00
pikax
c20d8af8c0 types: add symbolExtract to extract all known symbols
#951
2020-04-12 11:45:56 +01:00
Evan You
1d9f8fc979 release: v3.0.0-alpha.12 2020-04-08 18:59:49 -04:00
pikax
ab9add4f78 types: bring back my changes 2020-04-08 21:34:00 +01:00
ysj16
667e42065d
chore: typo (#928) 2020-04-06 09:09:44 -04:00
Evan You
5dcc645fc0 fix(reactivity): track reactive keys in raw collection types
Also warn against presence of both raw and reactive versions of the
same object in a collection as keys.

fix #919
2020-04-04 12:57:22 -04:00
Evan You
7402951d94 release: v3.0.0-alpha.11 2020-04-03 21:45:50 -04:00
Evan You
f3b6559408 fix(types/reactivity): add generics constraint for markNonReactive
fix #917
2020-04-03 21:06:03 -04:00
Evan You
0764c33d3d fix(reactivity): scheduled effect should not execute if stopped
fix #910
2020-04-02 19:50:48 -04:00
Evan You
de81faf00a release: v3.0.0-alpha.10 2020-03-24 18:33:40 -04:00
Evan You
45ba06ac5f fix(reactivity): should not trigger map keys iteration when keys did not change
fix #877
2020-03-24 12:43:06 -04:00
Evan You
1b2149dbb2 fix(reactivity): should not observe frozen objects
fix #867
2020-03-23 11:28:20 -04:00
Evan You
b8c1be18f3 refactor(types): use stricter settings
fix #847
2020-03-23 11:08:22 -04:00
Evan You
ba9a91c48c refactor: remove null comparisons 2020-03-18 18:14:51 -04:00
Evan You
5282ff0edb release: v3.0.0-alpha.9 2020-03-16 18:56:44 -04:00
djy0
b13886b1ba
types(reactivity): remove this in get accessor, fix #800 (#806) 2020-03-09 16:01:49 -04:00
Evan You
c75388d538 release: v3.0.0-alpha.8 2020-03-06 15:58:40 -05:00
Evan You
274f81c5db fix(reactivity): allow effect trigger inside no-track execution contexts
fix #804
2020-03-06 12:11:37 -05:00
hareku
643ff233af
types(reactivity): add undefined type to ref/shallowRef when no args (#791) 2020-03-06 11:32:39 -05:00
Evan You
a3066581f3 fix(reactivity): should not trigger length dependency on Array delete
close #774
2020-03-06 11:31:10 -05:00
Evan You
cc69fd72e3 fix(reactivity): Map/Set identity methods should work even if raw value contains reactive entries
fix #799
2020-03-06 11:10:02 -05:00
Evan You
16f9e63951
types: remove 'this' annotation from 'get' accessor (#801)
The next version of Typescript disallows 'this' parameter annotations on
accessors, which causes vue-next to fail to compile.

This PR removes the annotation and adds a cast instead.

Fixes #800
2020-03-05 16:57:52 -06:00
Evan You
bcb2a9b4a6 build: make @vue/shared public
This avoids it being inlined multiple times in esm bundler builds
2020-02-29 22:04:42 -05:00
Evan You
312513d255 release: v3.0.0-alpha.7 2020-02-26 14:36:38 -05:00
Evan You
3206e5dfe5 fix(types): shallowRef should not unwrap value type 2020-02-25 20:43:01 -05:00
Evan You
d4c6957e2d fix(types): ref value type unwrapping should happen at creation time 2020-02-25 19:44:06 -05:00
Evan You
9ab22c7ae6 release: v3.0.0-alpha.6 2020-02-22 08:25:32 +01:00
Evan You
b36a76fe23 chore: remove debugger [ci skip] 2020-02-22 05:19:22 +01:00
guaijie
76c7f54269
perf(effect): optimize effect trigger for array length mutation (#761) 2020-02-22 05:17:30 +01: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
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
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
478b4cfb2c release: v3.0.0-alpha.5 2020-02-18 15:00:55 -05: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
d293876c34 release: v3.0.0-alpha.4 2020-01-27 16:20:00 -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
Evan You
b41677bf42 release: v3.0.0-alpha.3 2020-01-22 11:10:30 -05:00
Evan You
2569890e31 refactor: move mockWarn utility to @vue/shared
close #652
2020-01-22 09:29:45 -05:00
likui
0c42a6d8fa types: refactor ref unwrapping (#646) 2020-01-20 13:22:18 -05:00
Rustin
5aa9868512 test(reactivity): declare the exact type (#644) 2020-01-20 12:02:08 -05:00
IU
2b4d0d6501 types(reactivity): handle primitive + object intersection types in UnwrapRef (#614) 2020-01-16 17:47:47 -05:00
Evan You
9f65d811af release: v3.0.0-alpha.2 2020-01-13 17:44:30 -05:00
likui
63a6563106 fix(reactivity): should delete observe value (#598)
fix #597
2020-01-13 17:11:49 -05:00
Jason Yu
c9bb346941 chore: update README.md (#592) [ci skip] 2020-01-07 13:19:54 -05:00
Carlos Rodrigues
985f4c91d9 types: improve isRef typing (#578) 2020-01-06 16:15:49 -05:00
Evan You
1bb1271b5e release: v3.0.0-alpha.1 2020-01-02 18:25:17 -05:00
Elad Frizi
1cf1ad5e94 test(reactivity): extracted repetitive assertions (#554) 2019-12-30 11:29:43 -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
bdbfead1e0 chore: adjust package.json 2019-12-19 14:19:58 -05:00
Evan You
35858cec8c build: adjust global names + allow inline overrides of build flags 2019-12-15 15:37:43 -05:00
Evan You
46c5393224 perf(reactivity): optimize effect stack 2019-12-13 23:06:55 -05:00
Evan You
136ab753b3 build: adjust esm formats 2019-12-10 22:14:02 -05:00
Evan You
8ed04ed503 build: release script 2019-12-10 21:29:52 -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
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
Junyan
a02820d7e0 feat: warn when toRefs() receives non-reactive object (#430) 2019-11-05 10:44:28 -05:00
IMGSS
d70497c0d4 chore: fix broken link (#420) 2019-11-04 14:33:24 -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
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
Evan You
34989ef7fe chore: license 2019-10-28 11:15:17 -04:00
Junyan
d76cfba7fb refactor(reactivity): reduce code of type check (#377) 2019-10-25 11:15:04 -04:00
夜宴
57276f9dcb test(effect): add test for json methods (#371) 2019-10-25 10:17:31 -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