Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commitaac7634

Browse files
committed
Revert "feat: auto cache inline prop literals to avoid child re-render"
This reverts commit996eb00.
1 parentec2c48c commitaac7634

File tree

6 files changed

+0
-83
lines changed

6 files changed

+0
-83
lines changed

‎flow/component.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ declare interface Component {
6969
_staticTrees: ?Array<VNode>; // v-once cached trees
7070
_hasHookEvent: boolean;
7171
_provided: ?Object;
72-
_inlineComputed: ?{[key:string]:Watcher}; // inline computed watchers for literal props
7372
// _virtualComponents?:{[key:string]:Component};
7473

7574
// private methods
@@ -131,8 +130,6 @@ declare interface Component {
131130
_k:(eventKeyCode:number,key:string,builtInAlias?:number|Array<number>, eventKeyName?: string) => ?boolean;
132131
// resolve scoped slots
133132
_u:(scopedSlots:ScopedSlotsData,res?:Object)=>{[key:string]:Function};
134-
// create / return value from inline computed
135-
_a: (id: number, getter: Function) =>any;
136133

137134
// SSR specific
138135
_ssrNode: Function;

‎src/compiler/parser/index.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,16 @@ const argRE = /:(.*)$/
2929
exportconstbindRE=/^:|^v-bind:/
3030
constmodifierRE=/\.[^.]+/g
3131

32-
constliteralValueRE=/^(\{.*\}|\[.*\])$/
33-
3432
constdecodeHTMLCached=cached(he.decode)
3533

3634
// configurable state
3735
exportletwarn:any
38-
letliteralPropId
3936
letdelimiters
4037
lettransforms
4138
letpreTransforms
4239
letpostTransforms
4340
letplatformIsPreTag
4441
letplatformMustUseProp
45-
letplatformIsReservedTag
4642
letplatformGetTagNamespace
4743

4844
typeAttr={name:string; value:string};
@@ -70,11 +66,9 @@ export function parse (
7066
options:CompilerOptions
7167
):ASTElement|void{
7268
warn=options.warn||baseWarn
73-
literalPropId=0
7469

7570
platformIsPreTag=options.isPreTag||no
7671
platformMustUseProp=options.mustUseProp||no
77-
platformIsReservedTag=options.isReservedTag||no
7872
platformGetTagNamespace=options.getTagNamespace||no
7973

8074
transforms=pluckModuleFunction(options.modules,'transformNode')
@@ -544,15 +538,6 @@ function processAttrs (el) {
544538
)
545539
}
546540
}
547-
// optimize literal values in component props by wrapping them
548-
// in an inline watcher to avoid unnecessary re-renders
549-
if(
550-
!platformIsReservedTag(el.tag)&&
551-
el.tag!=='slot'&&
552-
literalValueRE.test(value.trim())
553-
){
554-
value=`_a(${literalPropId++},function(){return${value}})`
555-
}
556541
if(isProp||(
557542
!el.component&&platformMustUseProp(el.tag,el.attrsMap.type,name)
558543
)){

‎src/core/instance/render-helpers/create-inline-computed.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎src/core/instance/render-helpers/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { bindObjectProps } from './bind-object-props'
1010
import{renderStatic,markOnce}from'./render-static'
1111
import{bindObjectListeners}from'./bind-object-listeners'
1212
import{resolveScopedSlots}from'./resolve-slots'
13-
import{createInlineComputed}from'./create-inline-computed'
1413

1514
exportfunctioninstallRenderHelpers(target:any){
1615
target._o=markOnce
@@ -28,5 +27,4 @@ export function installRenderHelpers (target: any) {
2827
target._e=createEmptyVNode
2928
target._u=resolveScopedSlots
3029
target._g=bindObjectListeners
31-
target._a=createInlineComputed
3230
}

‎src/core/instance/state.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export function proxy (target: Object, sourceKey: string, key: string) {
4747

4848
exportfunctioninitState(vm:Component){
4949
vm._watchers=[]
50-
vm._inlineComputed=null
5150
constopts=vm.$options
5251
if(opts.props)initProps(vm,opts.props)
5352
if(opts.methods)initMethods(vm,opts.methods)

‎test/unit/features/options/props.spec.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -512,38 +512,4 @@ describe('Options props', () => {
512512
expect(`"${attr}" is a reserved attribute`).toHaveBeenWarned()
513513
})
514514
})
515-
516-
it('should not trigger re-render on non-changed inline literals',done=>{
517-
constupdated=jasmine.createSpy('updated')
518-
constvm=newVue({
519-
data:{
520-
n:1,
521-
m:1
522-
},
523-
template:`
524-
<div id="app">
525-
{{ n }} {{ m }} <foo :a="{ n: 1 }" :b="{ n: n }"/>
526-
</div>
527-
`,
528-
components:{
529-
foo:{
530-
props:['a','b'],
531-
updated,
532-
template:`<div>{{ a.n }} {{ b.n }}</div>`
533-
}
534-
}
535-
}).$mount()
536-
537-
expect(vm.$el.textContent).toContain('1 1 1 1')
538-
vm.n++// literals that actually contain changed reactive data should trigger update
539-
waitForUpdate(()=>{
540-
expect(vm.$el.textContent).toContain('2 1 1 2')
541-
expect(updated.calls.count()).toBe(1)
542-
}).then(()=>{
543-
vm.m++// changing data that does not affect any literals should not trigger update
544-
}).then(()=>{
545-
expect(vm.$el.textContent).toContain('2 2 1 2')
546-
expect(updated.calls.count()).toBe(1)
547-
}).then(done)
548-
})
549515
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp