@@ -137,9 +137,9 @@ export const vnode_diff = (
137
137
let vCurrent : VNode | null = null ;
138
138
139
139
/// When we insert new node we start it here so that we can descend into it.
140
- /// NOTE: it can't be stored in `vCurrent` because `vNewCurrent ` is in journal
140
+ /// NOTE: it can't be stored in `vCurrent` because `vNewNode ` is in journal
141
141
/// and is not connected to the tree.
142
- let vNewNode : VNode | null = null ; // TODO: delete, because journal is on vNode, the above comment no longer applies
142
+ let vNewNode : VNode | null = null ;
143
143
144
144
/// When elements have keys they can be consumed out of order and therefore we can't use nextSibling.
145
145
/// In such a case this array will contain the elements after the current location.
@@ -615,14 +615,25 @@ export const vnode_diff = (
615
615
// But we need to mark them so that they don't get pulled into the diff.
616
616
const eventName = getEventNameFromJsxProp ( key ) ;
617
617
const scope = getEventNameScopeFromJsxProp ( key ) ;
618
- vnode_setProp (
619
- vNewNode as ElementVNode ,
620
- HANDLER_PREFIX + ':' + scope + ':' + eventName ,
621
- value
622
- ) ;
623
618
if ( eventName ) {
619
+ vnode_setProp (
620
+ vNewNode as ElementVNode ,
621
+ HANDLER_PREFIX + ':' + scope + ':' + eventName ,
622
+ value
623
+ ) ;
624
624
registerQwikLoaderEvent ( eventName ) ;
625
625
}
626
+
627
+ if ( scope ) {
628
+ // add an event attr with empty value for qwikloader element selector.
629
+ // We don't need value here. For ssr this value is a QRL,
630
+ // but for CSR value should be just empty
631
+ const htmlEvent = convertEventNameFromJsxPropToHtmlAttr ( key ) ;
632
+ if ( htmlEvent ) {
633
+ vnode_setAttr ( journal , vNewNode as ElementVNode , htmlEvent , '' ) ;
634
+ }
635
+ }
636
+
626
637
needsQDispatchEventPatch = true ;
627
638
continue ;
628
639
}
@@ -831,22 +842,21 @@ export const vnode_diff = (
831
842
832
843
const recordJsxEvent = ( key : string , value : any ) => {
833
844
const eventName = getEventNameFromJsxProp ( key ) ;
845
+ const scope = getEventNameScopeFromJsxProp ( key ) ;
834
846
if ( eventName ) {
835
- const scope = getEventNameScopeFromJsxProp ( key ) ;
836
847
record ( ':' + scope + ':' + eventName , value ) ;
848
+ // register an event for qwik loader
849
+ registerQwikLoaderEvent ( eventName ) ;
837
850
}
838
851
839
- // add an event attr with empty value for qwikloader element selector.
840
- // We don't need value here. For ssr this value is a QRL,
841
- // but for CSR value should be just empty
842
- const htmlEvent = convertEventNameFromJsxPropToHtmlAttr ( key ) ;
843
- if ( htmlEvent ) {
844
- record ( htmlEvent , '' ) ;
845
- }
846
-
847
- // register an event for qwik loader
848
- if ( eventName ) {
849
- registerQwikLoaderEvent ( eventName ) ;
852
+ if ( scope ) {
853
+ // add an event attr with empty value for qwikloader element selector.
854
+ // We don't need value here. For ssr this value is a QRL,
855
+ // but for CSR value should be just empty
856
+ const htmlEvent = convertEventNameFromJsxPropToHtmlAttr ( key ) ;
857
+ if ( htmlEvent ) {
858
+ record ( htmlEvent , '' ) ;
859
+ }
850
860
}
851
861
} ;
852
862
0 commit comments