Skip to content

Commit a369eeb

Browse files
committed
chore: add changesets
1 parent 48c0d87 commit a369eeb

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

.changeset/heavy-clouds-walk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik.dev/core': minor
3+
---
4+
5+
feat: support promises in attributes

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {
4646
} from '../shared/utils/markers';
4747
import { isPromise, retryOnPromise } from '../shared/utils/promises';
4848
import { isSlotProp } from '../shared/utils/prop';
49-
import { addComponentStylePrefix, hasClassAttr } from '../shared/utils/scoped-styles';
49+
import { hasClassAttr } from '../shared/utils/scoped-styles';
5050
import { serializeAttribute } from '../shared/utils/styles';
5151
import { isArray, type ValueOrPromise } from '../shared/utils/types';
5252
import { trackSignalAndAssignHost } from '../use/use-core';
@@ -191,7 +191,7 @@ export const vnode_diff = (
191191
}
192192
} else if (isPromise(jsxValue)) {
193193
expectVirtual(VirtualType.Awaited, null);
194-
asyncQueue.push(jsxValue, vNewNode || vCurrent, null);
194+
asyncQueue.push(jsxValue, vNewNode || vCurrent);
195195
} else if (isJSXNode(jsxValue)) {
196196
const type = jsxValue.type;
197197
if (typeof type === 'string') {
@@ -251,7 +251,7 @@ export const vnode_diff = (
251251
if (isPromise(e)) {
252252
// The thrown promise will resolve when the signal is ready, then retry fn() with retry logic
253253
const retryPromise = e.then(() => retryOnPromise(fn));
254-
asyncQueue.push(retryPromise, vNewNode || vCurrent, null);
254+
asyncQueue.push(retryPromise, vNewNode || vCurrent);
255255
return null;
256256
}
257257
throw e;
@@ -542,30 +542,21 @@ export const vnode_diff = (
542542

543543
function drainAsyncQueue(): ValueOrPromise<void> {
544544
while (asyncQueue.length) {
545-
let jsxNode = asyncQueue.shift() as ValueOrPromise<JSXChildren>;
545+
const jsxNode = asyncQueue.shift() as ValueOrPromise<JSXChildren>;
546546
const vHostNode = asyncQueue.shift() as VNode;
547-
const styleScopedId = asyncQueue.shift() as string | null;
548-
549-
const diffNode = (jsxNode: JSXChildren, vHostNode: VNode, styleScopedId: string | null) => {
550-
if (styleScopedId) {
551-
vnode_diff(container, jsxNode, vHostNode, addComponentStylePrefix(styleScopedId));
552-
} else {
553-
diff(jsxNode, vHostNode);
554-
}
555-
};
556547

557548
if (isPromise(jsxNode)) {
558549
return jsxNode
559550
.then((jsxNode) => {
560-
diffNode(jsxNode, vHostNode, styleScopedId);
551+
diff(jsxNode, vHostNode);
561552
return drainAsyncQueue();
562553
})
563554
.catch((e) => {
564555
container.handleError(e, vHostNode);
565556
return drainAsyncQueue();
566557
});
567558
} else {
568-
diffNode(jsxNode, vHostNode, styleScopedId);
559+
diff(jsxNode, vHostNode);
569560
}
570561
}
571562
}
@@ -1215,8 +1206,6 @@ export const vnode_diff = (
12151206
const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
12161207
const hashesAreEqual = componentHash === vNodeComponentHash;
12171208

1218-
const jsxChildren = jsxNode.children;
1219-
12201209
if (!lookupKeysAreEqual) {
12211210
const createNew = () => {
12221211
insertNewComponent(host, componentQRL, jsxProps);
@@ -1328,7 +1317,7 @@ export const vnode_diff = (
13281317
jsxNode.props
13291318
);
13301319

1331-
asyncQueue.push(jsxOutput, host, null);
1320+
asyncQueue.push(jsxOutput, host);
13321321
}
13331322
}
13341323
}

0 commit comments

Comments
 (0)