File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -2352,13 +2352,13 @@ function baseCreateRenderer(
23522352 namespace ,
23532353 )
23542354 }
2355+ container . _vnode = vnode
23552356 if ( ! isFlushing ) {
23562357 isFlushing = true
23572358 flushPreFlushCbs ( )
23582359 flushPostFlushCbs ( )
23592360 isFlushing = false
23602361 }
2361- container . _vnode = vnode
23622362 }
23632363
23642364 const internals : RendererInternals = {
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ describe('defineCustomElement', () => {
108108 myInputEl . removeAttribute ( 'value' )
109109 await nextTick ( )
110110 expect ( inputEl . value ) . toBe ( '' )
111+ app . unmount ( )
111112 } )
112113
113114 test ( 'should not unmount on move' , async ( ) => {
@@ -772,4 +773,33 @@ describe('defineCustomElement', () => {
772773 )
773774 } )
774775 } )
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+ } )
775805} )
You can’t perform that action at this time.
0 commit comments