facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
224.29k stars 45.71k forks source link

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

Closed yepitschunked closed 1 month ago

yepitschunked commented 1 month ago

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

josephsavona commented 1 month ago

Thanks for the heads up!

josephsavona commented 1 month ago

Fixed, thanks again for reporting!