@@ -51,7 +51,6 @@ import {
51
51
vnode_getDomParentVNode ,
52
52
vnode_getElementName ,
53
53
vnode_getFirstChild ,
54
- vnode_getNode ,
55
54
vnode_getProjectionParentComponent ,
56
55
vnode_getProps ,
57
56
vnode_getText ,
@@ -453,7 +452,7 @@ export const vnode_diff = (
453
452
}
454
453
455
454
function expectSlot ( ) {
456
- const vHost = vnode_getProjectionParentComponent ( vParent , container . rootVNode ) ;
455
+ const vHost = vnode_getProjectionParentComponent ( vParent ) ;
457
456
458
457
const slotNameKey = getSlotNameKey ( vHost ) ;
459
458
// console.log('expectSlot', JSON.stringify(slotNameKey));
@@ -668,15 +667,16 @@ export const vnode_diff = (
668
667
}
669
668
const key = jsx . key ;
670
669
if ( key ) {
671
- element . setAttribute ( ELEMENT_KEY , key ) ;
672
670
( vNewNode as ElementVNode ) . setProp ( ELEMENT_KEY , key ) ;
673
671
}
674
672
675
673
// append class attribute if styleScopedId exists and there is no class attribute
676
- const classAttributeExists =
677
- hasClassAttr ( jsx . varProps ) || ( jsx . constProps && hasClassAttr ( jsx . constProps ) ) ;
678
- if ( ! classAttributeExists && scopedStyleIdPrefix ) {
679
- element . setAttribute ( 'class' , scopedStyleIdPrefix ) ;
674
+ if ( scopedStyleIdPrefix ) {
675
+ const classAttributeExists =
676
+ hasClassAttr ( jsx . varProps ) || ( jsx . constProps && hasClassAttr ( jsx . constProps ) ) ;
677
+ if ( ! classAttributeExists ) {
678
+ element . setAttribute ( 'class' , scopedStyleIdPrefix ) ;
679
+ }
680
680
}
681
681
682
682
vnode_insertBefore ( journal , vParent as ElementVNode , vNewNode as ElementVNode , vCurrent ) ;
@@ -693,7 +693,7 @@ export const vnode_diff = (
693
693
694
694
const element = container . document . createElementNS ( elementNamespace , elementName ) ;
695
695
vNewNode = vnode_newElement ( element , elementName ) ;
696
- ( vNewNode as ElementVNode ) . flags |= elementNamespaceFlag ;
696
+ vNewNode . flags |= elementNamespaceFlag ;
697
697
return element ;
698
698
}
699
699
@@ -702,7 +702,6 @@ export const vnode_diff = (
702
702
vCurrent && vnode_isElementVNode ( vCurrent ) && elementName === vnode_getElementName ( vCurrent ) ;
703
703
const jsxKey : string | null = jsx . key ;
704
704
let needsQDispatchEventPatch = false ;
705
- const currentFile = getFileLocationFromJsx ( jsx . dev ) ;
706
705
if ( ! isSameElementName || jsxKey !== getKey ( vCurrent ) ) {
707
706
// So we have a key and it does not match the current node.
708
707
// We need to do a forward search to find it.
@@ -735,22 +734,23 @@ export const vnode_diff = (
735
734
}
736
735
const vNode = ( vNewNode || vCurrent ) as ElementVNode ;
737
736
738
- const element = ( vNode as ElementVNode ) . element as QElement ;
737
+ const element = vNode . element as QElement ;
739
738
if ( ! element . vNode ) {
740
739
element . vNode = vNode ;
741
740
}
742
741
743
742
needsQDispatchEventPatch =
744
- setBulkProps ( vNode , jsxAttrs , currentFile ) || needsQDispatchEventPatch ;
743
+ setBulkProps ( vNode , jsxAttrs , ( isDev && getFileLocationFromJsx ( jsx . dev ) ) || null ) ||
744
+ needsQDispatchEventPatch ;
745
745
if ( needsQDispatchEventPatch ) {
746
746
// Event handler needs to be patched onto the element.
747
747
if ( ! element . qDispatchEvent ) {
748
748
element . qDispatchEvent = ( event : Event , scope : QwikLoaderEventScope ) => {
749
749
const eventName = event . type ;
750
750
const eventProp = ':' + scope . substring ( 1 ) + ':' + eventName ;
751
751
const qrls = [
752
- ( vNode as ElementVNode ) . getProp < QRL > ( eventProp , null ) ,
753
- ( vNode as ElementVNode ) . getProp < QRL > ( HANDLER_PREFIX + eventProp , null ) ,
752
+ vNode . getProp < QRL > ( eventProp , null ) ,
753
+ vNode . getProp < QRL > ( HANDLER_PREFIX + eventProp , null ) ,
754
754
] ;
755
755
let returnValue = false ;
756
756
qrls . flat ( 2 ) . forEach ( ( qrl ) => {
@@ -778,7 +778,7 @@ export const vnode_diff = (
778
778
function setBulkProps (
779
779
vnode : ElementVNode ,
780
780
srcAttrs : ClientAttrs ,
781
- currentFile ? : string | null
781
+ currentFile : string | null
782
782
) : boolean {
783
783
vnode_ensureElementInflated ( vnode ) ;
784
784
const dstAttrs = vnode_getProps ( vnode ) as ClientAttrs ;
@@ -792,12 +792,12 @@ export const vnode_diff = (
792
792
793
793
const record = ( key : string , value : any ) => {
794
794
if ( key . startsWith ( ':' ) ) {
795
- ( vnode as ElementVNode ) . setProp ( key , value ) ;
795
+ vnode . setProp ( key , value ) ;
796
796
return ;
797
797
}
798
798
799
799
if ( key === 'ref' ) {
800
- const element = vnode_getNode ( vnode ) as Element ;
800
+ const element = vnode . element ;
801
801
if ( isSignal ( value ) ) {
802
802
value . value = element ;
803
803
return ;
@@ -815,7 +815,7 @@ export const vnode_diff = (
815
815
value = trackSignalAndAssignHost ( value , vnode , key , container , NON_CONST_SUBSCRIPTION_DATA ) ;
816
816
}
817
817
818
- ( vnode as ElementVNode ) . setAttr (
818
+ vnode . setAttr (
819
819
key ,
820
820
value !== null ? serializeAttribute ( key , value , scopedStyleIdPrefix ) : null ,
821
821
journal
@@ -1059,8 +1059,12 @@ export const vnode_diff = (
1059
1059
ELEMENT_PROPS ,
1060
1060
container . $getObjectById$
1061
1061
) ;
1062
- const propsAreDifferent = propsDiffer ( jsxProps , vNodeProps ) ;
1063
- shouldRender = shouldRender || propsAreDifferent ;
1062
+ let propsAreDifferent = false ;
1063
+ if ( ! shouldRender ) {
1064
+ propsAreDifferent = propsDiffer ( jsxProps , vNodeProps ) ;
1065
+ shouldRender = shouldRender || propsAreDifferent ;
1066
+ }
1067
+
1064
1068
if ( shouldRender ) {
1065
1069
if ( propsAreDifferent ) {
1066
1070
if ( vNodeProps ) {
0 commit comments