File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -2352,13 +2352,13 @@ function baseCreateRenderer(
2352
2352
namespace ,
2353
2353
)
2354
2354
}
2355
+ container . _vnode = vnode
2355
2356
if ( ! isFlushing ) {
2356
2357
isFlushing = true
2357
2358
flushPreFlushCbs ( )
2358
2359
flushPostFlushCbs ( )
2359
2360
isFlushing = false
2360
2361
}
2361
- container . _vnode = vnode
2362
2362
}
2363
2363
2364
2364
const internals : RendererInternals = {
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ describe('defineCustomElement', () => {
108
108
myInputEl . removeAttribute ( 'value' )
109
109
await nextTick ( )
110
110
expect ( inputEl . value ) . toBe ( '' )
111
+ app . unmount ( )
111
112
} )
112
113
113
114
test ( 'should not unmount on move' , async ( ) => {
@@ -772,4 +773,33 @@ describe('defineCustomElement', () => {
772
773
)
773
774
} )
774
775
} )
776
+
777
+ // #9885
778
+ test ( 'avoid double mount when prop is set immediately after mount' , ( ) => {
779
+ customElements . define (
780
+ 'my-input-dupe' ,
781
+ defineCustomElement ( {
782
+ props : {
783
+ value : String ,
784
+ } ,
785
+ render ( ) {
786
+ return 'hello'
787
+ } ,
788
+ } ) ,
789
+ )
790
+ createApp ( {
791
+ render ( ) {
792
+ return h ( 'div' , [
793
+ h ( 'my-input-dupe' , {
794
+ onVnodeMounted ( vnode ) {
795
+ vnode . el ! . value = 'fesfes'
796
+ } ,
797
+ } ) ,
798
+ ] )
799
+ } ,
800
+ } ) . mount ( container )
801
+ expect ( container . children [ 0 ] . children [ 0 ] . shadowRoot ?. innerHTML ) . toBe (
802
+ 'hello' ,
803
+ )
804
+ } )
775
805
} )
You can’t perform that action at this time.
0 commit comments