react icon indicating copy to clipboard operation
react copied to clipboard

[React 19] React compiler strips `await` from `for await` loops

Open yepitschunked opened this issue 1 month ago • 1 comments

Summary

React compiler is compiling

async function MyApp({ something }) {
  for await (const deferredState of foo) {
    // do stuff
  }
}

into

async function MyApp(t0) {
  for (const deferredState of foo) {
  }
}

i.e the for await became a regular for.

https://playground.react.dev/#N4Igzg9grgTgxgUxALhAQzATwHZwAQBmUuALgJYTZ4CymAggA4MAUwekAtgiQBZnYBzPAF8AlHmAAdKoQgw8aAO5oyJPMziUwagCYICCGDAQ6AyiTQkEeCAVkRxUmXjwB6V3h0R2JKAQLSLsLSwdggwkA

yepitschunked avatar May 16 '24 19:05 yepitschunked