Skip to content

Commit 00287c6

Browse files
committed
wip fixes
1 parent 42bd4f8 commit 00287c6

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

packages/qwik/src/core/client/vnode-diff.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ export const vnode_diff = (
864864
const recordJsxEvent = (key: string, value: any) => {
865865
const data = getEventDataFromHtmlAttribute(key);
866866
if (data) {
867-
const [eventName, scope] = data;
867+
const [scope, eventName] = data;
868868
record(':' + scope + ':' + eventName, value);
869869
// register an event for qwik loader
870870
registerQwikLoaderEvent(eventName);
@@ -908,10 +908,18 @@ export const vnode_diff = (
908908
// Keys match: update if values differ
909909
const srcValue = srcAttrs[srcIdx + 1];
910910
const dstValue = dstAttrs[dstIdx + 1];
911+
const isEventHandler = isHtmlAttributeAnEventName(srcKey);
911912
if (srcValue !== dstValue) {
912-
record(srcKey, srcValue);
913-
// Update in place doesn't change array length
913+
if (isEventHandler) {
914+
recordJsxEvent(srcKey, srcValue);
915+
} else {
916+
record(srcKey, srcValue);
917+
}
918+
} else if (isEventHandler && !vnode.element.qDispatchEvent) {
919+
// Special case: add event handlers after resume
920+
recordJsxEvent(srcKey, srcValue);
914921
}
922+
// Update in place doesn't change array length
915923
srcIdx += 2; // skip key and value
916924
dstIdx += 2; // skip key and value
917925
} else if (srcKey < dstKey) {

packages/qwik/src/core/shared/jsx/jsx-node.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ export class JSXNodeImpl<T = unknown> implements JSXNodeInternal<T> {
6161
if (attr) {
6262
// constProps always wins
6363
if (!constProps || !(k in constProps)) {
64-
toSort ||= mergeHandlers(this.varProps, attr, this.varProps[k] as QRL);
64+
toSort = mergeHandlers(this.varProps, attr, this.varProps[k] as QRL) || toSort;
6565
}
6666
delete this.varProps[k];
6767
}
6868
}
6969

7070
// bind:*
7171
if (BIND_CHECKED in this.varProps) {
72-
toSort ||= handleBindProp(this.varProps, BIND_CHECKED)!;
72+
toSort = handleBindProp(this.varProps, BIND_CHECKED)! || toSort;
7373
} else if (BIND_VALUE in this.varProps) {
74-
toSort ||= handleBindProp(this.varProps, BIND_VALUE)!;
74+
toSort = handleBindProp(this.varProps, BIND_VALUE)! || toSort;
7575
} else if (this.constProps) {
7676
if (BIND_CHECKED in this.constProps) {
7777
handleBindProp(this.constProps, BIND_CHECKED);

0 commit comments

Comments
 (0)