This repository was archived by the owner on Jul 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-14
lines changed
packages/runtime-vapor/src Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -7,18 +7,19 @@ export function patchAttrs(instance: ComponentInternalInstance) {
7
7
const options = instance . propsOptions [ 0 ]
8
8
9
9
const keys = new Set < string > ( )
10
- for ( const props of Array . from ( instance . rawProps ) . reverse ( ) ) {
11
- if ( isFunction ( props ) ) {
12
- const resolved = props ( )
13
- for ( const rawKey in resolved ) {
14
- registerAttr ( rawKey , ( ) => resolved [ rawKey ] )
15
- }
16
- } else {
17
- for ( const rawKey in props ) {
18
- registerAttr ( rawKey , props [ rawKey ] )
10
+ if ( instance . rawProps . length )
11
+ for ( const props of Array . from ( instance . rawProps ) . reverse ( ) ) {
12
+ if ( isFunction ( props ) ) {
13
+ const resolved = props ( )
14
+ for ( const rawKey in resolved ) {
15
+ registerAttr ( rawKey , ( ) => resolved [ rawKey ] )
16
+ }
17
+ } else {
18
+ for ( const rawKey in props ) {
19
+ registerAttr ( rawKey , props [ rawKey ] )
20
+ }
19
21
}
20
22
}
21
- }
22
23
23
24
for ( const key in attrs ) {
24
25
if ( ! keys . has ( key ) ) {
Original file line number Diff line number Diff line change @@ -91,8 +91,8 @@ export function initProps(
91
91
92
92
const [ options ] = instance . propsOptions
93
93
94
+ const hasDynamicProps = rawProps . some ( isFunction )
94
95
if ( options ) {
95
- const hasDynamicProps = rawProps . some ( isFunction )
96
96
if ( hasDynamicProps ) {
97
97
for ( const key in options ) {
98
98
const getter = ( ) =>
@@ -121,9 +121,13 @@ export function initProps(
121
121
validateProps ( rawProps , props , options || { } )
122
122
}
123
123
124
- baseWatch ( ( ) => patchAttrs ( instance ) , undefined , {
125
- scheduler : createVaporPreScheduler ( instance ) ,
126
- } )
124
+ if ( hasDynamicProps ) {
125
+ baseWatch ( ( ) => patchAttrs ( instance ) , undefined , {
126
+ scheduler : createVaporPreScheduler ( instance ) ,
127
+ } )
128
+ } else {
129
+ patchAttrs ( instance )
130
+ }
127
131
128
132
if ( isStateful ) {
129
133
instance . props = props
You can’t perform that action at this time.
0 commit comments