Commit Graph

367 Commits

Author SHA1 Message Date
Evan You
5bfcad155b fix(suspense): should discard unmount effects of invalidated pending branch 2020-09-17 23:49:06 -04:00
Evan You
49bb44756f refactor: watch APIs default to trigger pre-flush
BREAKING CHANGE: watch APIs now default to use `flush: 'pre'` instead of
`flush: 'post'`.

  - This change affects `watch`, `watchEffect`, the `watch` component
    option, and `this.$watch`.

  - As pointed out by @skirtles-code in
    [this comment](https://github.com/vuejs/vue-next/issues/1706#issuecomment-666258948),
    Vue 2's watch behavior is pre-flush, and the ecosystem has many uses
    of watch that assumes the pre-flush behavior. Defaulting to post-flush
    can result in unnecessary re-renders without the users being aware of
    it.

  - With this change, watchers need to specify `{ flush: 'post' }` via
    options to trigger callback after Vue render updates. Note that
    specifying `{ flush: 'post' }` will also defer `watchEffect`'s
    initial run to wait for the component's initial render.
2020-09-17 23:17:21 -04:00
Evan You
58c31e3699 feat(runtime-core): support using inject() inside props default functions 2020-09-17 15:59:01 -04:00
Evan You
c7b4a379cf fix(runtime-core/async-component): fix error component when there are no error handlers
fix #2129
2020-09-16 11:10:16 -04:00
Evan You
3810de7d6b fix(reactivity): effect shoud only recursively self trigger with explicit options
fix #2125
2020-09-16 10:52:31 -04:00
Evan You
5ae7380b4a
feat: update Suspense usage (#2099)
See https://github.com/vuejs/vue-next/pull/2099 for details.
2020-09-15 12:45:06 -04:00
HuangYi
98cc1f9d84
fix(KeepAlive): when exclude prop change, it should prune cache that not matched (#2111) 2020-09-15 10:33:50 -04:00
edison
0cddde6aa4
test(runtime-core): test app API warnings (#2079) 2020-09-14 21:48:38 -04:00
被雨水过滤的空气
890ca8aa34
fix(keep-alive): should use onMounted and onUpdated to invoke cacheSubtree (#1984) 2020-09-14 20:50:06 -04:00
Evan You
124c385baf perf: should not trigger child update if changed prop is declared emit listener
close #2072
2020-09-14 18:58:30 -04:00
Evan You
4de5b111ee test: fix cloneVNode ref tests 2020-09-14 18:55:00 -04:00
underfin
a32870a8f6
fix: inherit el for static nodes inside keyed template fragment (#2089)
fix #2080
2020-09-14 16:02:29 -04:00
Evan You
612eb6712a fix(runtime-core/refs): handle multiple merged refs for dynamic component with vnode
fix #2078
2020-09-14 15:33:38 -04:00
Stanislav Lashmanov
313dd06065
fix(runtime-core/inject): handle optional from option in inject object config (#2073) 2020-09-14 12:52:19 -04:00
Evan You
d4724619fc fix(inject): fix support for inject option default function
fix #2050
2020-09-04 12:07:30 -04:00
ᴜɴвʏтᴇ
95c07d8c36
fix(runtime-core): fix priority of option merging (#2041) 2020-09-03 10:35:43 -04:00
Evan You
ad93fa42fc fix(runtime-core): openBlock() should not be tracked when block tracking is disabled 2020-09-02 12:30:37 -04:00
HcySunYang
63f1f18064
fix(runtime-core): v-model listeners that already exists on the component should not be merged (#2011)
fix #1989
2020-09-01 22:24:20 -04:00
HcySunYang
93b8ff94a4
polish(teleport): do not warn missing target when teleport is disabled (#2021) 2020-09-01 21:05:51 -04:00
zhangzhonghe
0d0970f9cd
refactor(runtime-core): remove the deactivated branch in unmountComponent method (#2012) 2020-09-01 21:03:50 -04:00
Evan You
c0427b45ff fix(sfc/scoped-style): inherit scopeId through nested HOCs with inheritAttrs: false
fix #1988
2020-09-01 18:56:02 -04:00
HcySunYang
5b82c48c7b
fix(runtime-core): enable block tracking when normalizing plain element with slot children (#1987)
fix #1980
2020-09-01 12:38:47 -04:00
ᴜɴвʏтᴇ
706b52aadd
fix(runtime-core): ensure consistent $options merge behavior with 2.x (#1986)
close #1978 , close #1979
2020-08-31 21:04:06 -04:00
Evan You
8ed0b342d4 fix(runtime-core): fix props/emits resolving with global mixins
fix #1975
2020-08-31 18:32:07 -04:00
Evan You
0cb7f7f880 fix(runtime-core): fix resolving assets from mixins and extends
fix #1963
2020-08-26 18:09:54 -04:00
Pick
d0cc4b37d0
test(runtime-core): add tests for componentSlots (#1940) 2020-08-26 12:17:21 -04:00
HcySunYang
6df0e738cb
fix(runtime-core): properly call lifecycle hooks in chained mixins & extends (#1974)
fix #1973
2020-08-26 10:31:23 -04:00
HcySunYang
9153fc2d8a
fix(runtime-core): class and style should be properly normalized in cloneVNode (#1967)
fix #1964
2020-08-26 09:37:28 -04:00
Evan You
c15311cfe8 fix(runtime-core): fix data merge order for mixins/extends
fix #1953
2020-08-24 21:30:04 -04:00
Evan You
36fa42a88c fix(runtime-core/scheduler): handle nested flushPostFlushCbs calls
fix #1947
2020-08-24 18:47:15 -04:00
Yang Mingshan
10293c7a18
fix(watch): traverse refs in deep watch (#1939)
ref #1900
2020-08-23 14:41:11 -04:00
Evan You
54d06ec495 feat(runtime-core): support variadic children in h for simple JSX compat
ref: #1917
2020-08-21 21:54:33 -04:00
Evan You
7454e2a52b build(deps): upgrade to TypeScript 4 2020-08-20 17:48:28 -04:00
HcySunYang
255a2bd178
test(runtime-core): add tests for the optimized mode (#1884) 2020-08-20 10:56:31 -04:00
Evan You
d4cc7b2496 fix(teleport): only inherit el for non-patched nodes
fix #1903
2020-08-20 10:44:28 -04:00
Evan You
1eb6067a85 fix(runtime-core): fix beforeUpdate call timing to allow state mutation
fix #1899
2020-08-19 17:57:51 -04:00
Evan You
eb2ae44d94 refactor(types): widen Component type to include consutructor types
returned from `defineComponent`

ref: https://github.com/vuejs/vue-router-next/pull/421
also close #1880

Previous `Component` type is now exported as `ConcreteComponent`.

This introduces a minor breaking change when calling `h(comp, { ... })`
will now fail if `comp` is a of generic `Component` type, since it does
not specify what props it expects.
2020-08-19 16:19:25 -04:00
Evan You
223f180529 test(watch): add same value skipping trigger test 2020-08-14 17:35:49 -04:00
HcySunYang
caccec3f78
fix(runtime-core/scheduler): sort postFlushCbs to ensure refs are set before lifecycle hooks (#1854)
fix #1852
2020-08-14 09:50:23 -04:00
Evan You
611437a3fe fix(runtime-core/scheduler): allow component render functions to trigger itself
fix #1801
2020-08-13 17:42:47 -04:00
HcySunYang
3991ff03ce
fix(runtime-core): separate null vs. non-null ref value updates (#1835)
fix #1789, fix #1834
2020-08-13 12:27:17 -04:00
Evan You
791eff3dfb fix(runtime-core): avoid manual slot invocation in template expressions interfering with block tracking
fix #1745
2020-08-06 10:16:13 -04:00
zhangzhonghe
233d191d0d
fix(keep-alive): fix activated hook invocation on nested components (#1743)
fix #1742
2020-08-06 09:42:52 -04:00
Evan You
3692f2738f refactor(runtime-core/scheduler): dedicated preFlush queue
properly fix #1763, #1777, #1781
2020-08-05 10:55:23 -04:00
Evan You
a0e34cee4a fix(watch): exhaust pre-flush watchers + avoid duplicate render by pre-flush watchers
close #1777
2020-08-04 13:20:23 -04:00
Eduardo San Martin Morote
b5f91ff570
fix(watch): allow handler to be a string (#1775)
fix #1774
2020-08-04 12:42:47 -04:00
Yang Mingshan
b2a91429ed
fix(runtime-core/scheduler): prevent duplicate queue (#1767) 2020-08-03 17:19:06 -04:00
Evan You
d4c17fb48b fix(watch): pre-flush watcher watching props should trigger before component update
fix #1763
2020-08-03 16:49:30 -04:00
Evan You
fce2689ff1 fix(watch): should trigger watcher callback on triggerRef when watching ref source
fix #1736
2020-07-30 18:29:38 -04:00
Evan You
09702e95b9 fix(runtime-core/scheduler): only allow watch callbacks to be self-triggering
fix #1740

Previous fix for #1727 caused `watchEffect` to also recursively trigger
itself on reactive array mutations which implicitly registers array
`.length` as dependencies and mutates it at the same time.

This fix limits recursive trigger behavior to only `watch()` callbacks
since code inside the callback do not register dependencies and
mutations are always explicitly intended.
2020-07-30 17:57:20 -04:00