Skip to content

Commit 145f0b6

Browse files
committed
fix(compiler): handle AwaitExpression in settled() to prevent false zero-delay classification
An AwaitExpression whose argument is an opaque promise (e.g. await load()) yields past paint, so it is not zero-delay. Previously, settled() fell through to nonPromise() which correctly identifies await results as non-thenables but does not answer whether evaluating the await completes without yielding. Add an explicit AwaitExpression case to settled() that recurses into the argument. This makes settled(await load()) false when load() is opaque, which prevents await (null ?? await load()) and await (true && await load()) from being misclassified as zero-delay awaits.
1 parent 6f167ed commit 145f0b6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎packages/octane/src/compiler/strong-effects.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ export function createStrongEffectPolicy({ ast, analysis, callNames, report }) {
204204
function settled(expression, depth = 0) {
205205
const node = unwrap(expression);
206206
switch (node?.type) {
207+
case 'AwaitExpression':
208+
return settled(node.argument, depth);
207209
case 'SequenceExpression':
208210
return settled(node.expressions?.at(-1), depth);
209211
case 'ConditionalExpression':

0 commit comments

Comments
 (0)