angular/packages/zone.js/lib/common
arturovt 260d3ed0d9 fix(zone.js): patch Response methods returned by fetch (#50653)
This commit updates the implementation of the `fetch` patch and additionally
patches `Response` methods which return promises. These are `arrayBuffer`, `blob`,
`formData`, `json` and `text`. This fixes the issue when zone becomes stable too early
before all of the `fetch` tasks complete. Given the following code:
```ts
appRef.isStable.subscribe(console.log);
fetch(...).then(response => response.json()).then(console.log);
```
The `isStable` observer would log `false, true, false, true`. This was happening because
`json()` was returning a native promise (and not a `ZoneAwarePromise`). But calling `then`
on the native promise returns a `ZoneAwarePromise` which notifies Angular about the task
being scheduled and forces to re-calculate the `isStable` state.

Issue: #50327

PR Close #50653
2024-01-31 14:57:25 +00:00
..
error-rewrite.ts refactor(zone.js): change from scripts to modules (#53445) 2024-01-09 13:20:50 -08:00
events.ts fix(zone.js): handle fetch with AbortSignal (#49595) 2023-12-18 15:35:10 +00:00
fetch.ts fix(zone.js): patch Response methods returned by fetch (#50653) 2024-01-31 14:57:25 +00:00
promise.ts feat(zone.js): implement Promise.withResolvers() (#53514) 2023-12-12 09:04:44 -08:00
queue-microtask.ts fix(zone.js): enable monkey patching of the queueMicrotask() API in node.js (#50530) 2023-06-07 12:42:33 -07:00
timers.ts fix(zone.js): setTimeout patch should clean tasksByHandleId cache. (#40586) 2021-02-09 10:43:05 -08:00
to-string.ts fix(zone.js): zone.js toString patch should check typeof Promise is function (#38350) 2020-08-25 09:51:50 -07:00
utils.ts fix(zone.js): use globalThis instead of global and window (#52367) 2023-10-25 09:31:17 -07:00