mirror of
https://github.com/angular/angular.git
synced 2026-11-23 07:05:14 -05:00
`triggerHydrationForBlockQueue` accessed `blocksBeingHydrated.get(dehydratedBlockId)` with a non-null assertion `!.resolve()`. If the entry was cleaned up while the function was suspended awaiting resource loading or next render, this resulted in an unhandled `TypeError: Cannot read properties of undefined (reading 'resolve')`.
Additionally, the pending task added by `pendingTasks.add()` was not guarded by a `try/finally`, causing the task to leak and permanently breaking application stability whenever hydration encountered an error or threw an exception.
This commit optional-chains `.resolve()` matching sibling accesses and wraps the queue processing loop in `try/finally` so `pendingTasks.remove(taskId)` is always invoked.
Fixes #71769
(cherry picked from commit af620ea3d9)