next.js
aec3c58d - Update edge-runtime to latest (#51944)

Commit
2 years ago
Update edge-runtime to latest (#51944) ### What? The updates `edge-runtime` to the latest version ### Why? https://github.com/vercel/edge-runtime/pull/428 fixes `consumeUint8ArrayReadableStream` so that when we break iteration early (due to client disconnect), we cleanup the inner stream. That will fire the stream's `cancel` handler, and allow devs to disconnect from an AI service fetch. ### How? `edge-runtime` maintain a `try {} finally {}` over the inner stream's iteration. When we early break, JS will call `it.return()`, and that will resume `consumeUint8ArrayReadableStream` with an abrupt completion (essentially, the `yield` turns into a `return`). We'll be able to trigger the `finally {}` block with that, and we call `inner.cancel()` to cleanup. Fixes https://github.com/vercel-labs/ai/issues/90
Author
Parents
Loading