Skip to content

fix(adev): reset webcontainer counter when user dismisses OOM warning#67371

Open
flowerjunjie wants to merge 1 commit intoangular:mainfrom
flowerjunjie:fix/issue-52647
Open

fix(adev): reset webcontainer counter when user dismisses OOM warning#67371
flowerjunjie wants to merge 1 commit intoangular:mainfrom
flowerjunjie:fix/issue-52647

Conversation

@flowerjunjie
Copy link

Fixes #52647

Problem

When an OOM error occurs in Safari, the tab may be automatically reloaded without firing the beforeunload event. This causes the webcontainer counter to not decrease, resulting in false positive OOM warnings even when the user has fewer than 3 tabs open.

Solution

Reset the webcontainer counter to 0 when the user dismisses the OOM warning snackbar. This ensures the counter is accurate after an OOM-related page reload.

Changes

  • Subscribe to afterDismissed() event on the snackbar reference
  • Call resetWebcontainerCounter() when the snackbar is dismissed
  • Reset counter sets WEBCONTAINERS_COUNTER_KEY to 0 in localStorage

Testing

  • Verified the counter is reset when clicking "I understand" on the OOM warning
  • Counter will be accurate after Safari auto-reload on OOM

When an OOM error occurs in Safari, the tab may be automatically reloaded
without firing the beforeunload event, causing the webcontainer counter
to not decrease. This results in false positive OOM warnings even when
the user has fewer than 3 tabs open.

This fix resets the webcontainer counter to 0 when the user dismisses
the OOM warning snackbar, ensuring the counter is accurate after an
OOM-related page reload.

Fixes angular#52647
@google-cla
Copy link

google-cla bot commented Feb 28, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@pullapprove pullapprove bot requested a review from AndrewKushnir February 28, 2026 22:44
@AndrewKushnir AndrewKushnir requested review from JeanMeche and removed request for AndrewKushnir March 1, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: counter of running webcontainer is not decreased when browser crashed due to OOM

2 participants