fix: only emit `for_await_track_reactivity_loss` in async mode (#16644)

Helps with #16610  (but does not fix it yet)
pull/16642/head
ComputerGuy 2 weeks ago committed by GitHub
parent a60995abef
commit 11a2d8e937
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: only emit `for_await_track_reactivity_loss` in async mode

@ -8,7 +8,12 @@ import { dev, is_ignored } from '../../../../state.js';
* @param {ComponentContext} context
*/
export function ForOfStatement(node, context) {
if (node.await && dev && !is_ignored(node, 'await_reactivity_loss')) {
if (
node.await &&
dev &&
!is_ignored(node, 'await_reactivity_loss') &&
context.state.options.experimental.async
) {
const left = /** @type {VariableDeclaration | Pattern} */ (context.visit(node.left));
const argument = /** @type {Expression} */ (context.visit(node.right));
const body = /** @type {Statement} */ (context.visit(node.body));

Loading…
Cancel
Save