Repository navigation
[flutter_tools] Safely remove web loading indicator on dart-app-ready - #192233
Merged
auto-submit[bot] merged 1 commit intoSep 8, 2026
Merged
Conversation
When the debug WebSocket connection temporarily drops and reconnects,
DWDS dispatches a subsequent 'dart-app-ready' event. Previously, the event
listener in the bootstrapping script directly called
`loader.parentNode.removeChild(loader)`, which caused an unhandled TypeError
("Cannot read properties of null (reading 'removeChild')") on subsequent
events because the loader had already been detached.
Configure the 'dart-app-ready' event listener with `{ once: true }` so it
runs at most once, and use `loader.remove()` and `styleSheet.remove()` to safely
remove the elements without relying on `parentNode`.
Fixes flutter#192226
bkonyi
marked this pull request as ready for review
September 3, 2026 19:48
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the web bootstrap script generation to use Element.remove() instead of parentNode.removeChild() for removing the loader and stylesheet elements, and configures the 'dart-app-ready' event listener to trigger only once by passing the { once: true } option. Corresponding unit tests have been added to verify these changes. I have no feedback to provide.
This was referenced Sep 8, 2026
auto-submit Bot
pushed a commit
to flutter/packages
that referenced
this pull request
Sep 8, 2026
flutter/flutter@63170e9...b444e78 2026-09-08 [email protected] Clean up lint errors in workflows (flutter/flutter#191987) 2026-09-08 [email protected] Remove no-shuffle tag from dropdown_test.dart (flutter/flutter#186398) 2026-09-08 [email protected] Remove no-shuffle from scrollbar test (flutter/flutter#186656) 2026-09-08 [email protected] [tool] Let --local-engine reach the build system again (flutter/flutter#192361) 2026-09-08 [email protected] [flutter_tools] Safely remove web loading indicator on dart-app-ready (flutter/flutter#192233) 2026-09-08 [email protected] [Linux] Don't clear the OpenGL context when a frame has been drawn (flutter/flutter#192137) 2026-09-08 [email protected] ci: update dartdoc from 9.0.6 to 9.0.9 (flutter/flutter#192405) 2026-09-07 [email protected] Add itemExtentBuilder support to ListView.separated (flutter/flutter#191157) 2026-09-07 [email protected] Roll Skia from e1437642d259 to b3fa80a0e168 (5 revisions) (flutter/flutter#192362) 2026-09-07 [email protected] Roll Skia from 2df865d9d369 to e1437642d259 (1 revision) (flutter/flutter#192360) 2026-09-07 [email protected] Roll Skia from c7aa5512d148 to 2df865d9d369 (2 revisions) (flutter/flutter#192357) 2026-09-06 [email protected] Roll Skia from db200e27a634 to c7aa5512d148 (2 revisions) (flutter/flutter#192351) 2026-09-06 [email protected] Roll Fuchsia Linux SDK from _IgixhH4vEgdz9Oqn... to p8hHkUi8uWT9R3N4z... (flutter/flutter#192349) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni
pushed a commit
to victorsanni/packages
that referenced
this pull request
Sep 9, 2026
…r#12791) flutter/flutter@63170e9...b444e78 2026-09-08 [email protected] Clean up lint errors in workflows (flutter/flutter#191987) 2026-09-08 [email protected] Remove no-shuffle tag from dropdown_test.dart (flutter/flutter#186398) 2026-09-08 [email protected] Remove no-shuffle from scrollbar test (flutter/flutter#186656) 2026-09-08 [email protected] [tool] Let --local-engine reach the build system again (flutter/flutter#192361) 2026-09-08 [email protected] [flutter_tools] Safely remove web loading indicator on dart-app-ready (flutter/flutter#192233) 2026-09-08 [email protected] [Linux] Don't clear the OpenGL context when a frame has been drawn (flutter/flutter#192137) 2026-09-08 [email protected] ci: update dartdoc from 9.0.6 to 9.0.9 (flutter/flutter#192405) 2026-09-07 [email protected] Add itemExtentBuilder support to ListView.separated (flutter/flutter#191157) 2026-09-07 [email protected] Roll Skia from e1437642d259 to b3fa80a0e168 (5 revisions) (flutter/flutter#192362) 2026-09-07 [email protected] Roll Skia from 2df865d9d369 to e1437642d259 (1 revision) (flutter/flutter#192360) 2026-09-07 [email protected] Roll Skia from c7aa5512d148 to 2df865d9d369 (2 revisions) (flutter/flutter#192357) 2026-09-06 [email protected] Roll Skia from db200e27a634 to c7aa5512d148 (2 revisions) (flutter/flutter#192351) 2026-09-06 [email protected] Roll Fuchsia Linux SDK from _IgixhH4vEgdz9Oqn... to p8hHkUi8uWT9R3N4z... (flutter/flutter#192349) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni
pushed a commit
to victorsanni/packages
that referenced
this pull request
Sep 9, 2026
…r#12791) flutter/flutter@63170e9...b444e78 2026-09-08 [email protected] Clean up lint errors in workflows (flutter/flutter#191987) 2026-09-08 [email protected] Remove no-shuffle tag from dropdown_test.dart (flutter/flutter#186398) 2026-09-08 [email protected] Remove no-shuffle from scrollbar test (flutter/flutter#186656) 2026-09-08 [email protected] [tool] Let --local-engine reach the build system again (flutter/flutter#192361) 2026-09-08 [email protected] [flutter_tools] Safely remove web loading indicator on dart-app-ready (flutter/flutter#192233) 2026-09-08 [email protected] [Linux] Don't clear the OpenGL context when a frame has been drawn (flutter/flutter#192137) 2026-09-08 [email protected] ci: update dartdoc from 9.0.6 to 9.0.9 (flutter/flutter#192405) 2026-09-07 [email protected] Add itemExtentBuilder support to ListView.separated (flutter/flutter#191157) 2026-09-07 [email protected] Roll Skia from e1437642d259 to b3fa80a0e168 (5 revisions) (flutter/flutter#192362) 2026-09-07 [email protected] Roll Skia from 2df865d9d369 to e1437642d259 (1 revision) (flutter/flutter#192360) 2026-09-07 [email protected] Roll Skia from c7aa5512d148 to 2df865d9d369 (2 revisions) (flutter/flutter#192357) 2026-09-06 [email protected] Roll Skia from db200e27a634 to c7aa5512d148 (2 revisions) (flutter/flutter#192351) 2026-09-06 [email protected] Roll Fuchsia Linux SDK from _IgixhH4vEgdz9Oqn... to p8hHkUi8uWT9R3N4z... (flutter/flutter#192349) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #192226
Problem
In
packages/flutter_tools/lib/src/web/bootstrap.dart, when compiling the web bootstrap script (main.dart.js), an event listener was added towindowfordart-app-readythat executed:On initial load, this removes the loader from the DOM, setting
loader.parentNodetonull.When DWDS reconnects or re-dispatches
dart-app-ready(e.g. following a WebSocket disconnect/reconnect), this listener was invoked again. Attempting to call.removeChildon anullparentNodethrew:Solution
loader.remove()andstyleSheet.remove()instead ofparentNode.removeChild().{ once: true }so it is automatically removed after firing once.Tests
Added regression unit tests to
packages/flutter_tools/test/general.shard/web/bootstrap_test.dartverifying that{ once: true }and.remove()are used in generated web bootstrap code.