-
Notifications
You must be signed in to change notification settings - Fork 29.4k
[beta] CP: Fixes hot reload/restart crashes after closing browser tab on web-server device #177456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: flutter-3.38-candidate.0
Are you sure you want to change the base?
Conversation
|
This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter. Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses a crash during hot reload/restart on web-server devices when no client is connected. The introduction of specific error handling for RPCErrors and a new _handleNoClientsAvailable helper method for graceful failure is a solid approach. The refactoring improves code readability, and the addition of a new integration test ensures the fix is well-covered. Overall, these are good changes that improve the developer experience for Flutter web.
| 'instance in Chrome.\nThis can happen if the websocket connection used by the ' | ||
| 'web tooling is unable to correctly establish a connection, for example due to a firewall.'; | ||
|
|
||
| const kNoClientConnectedMessage = 'Recompile complete. No client connected.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new public constant kNoClientConnectedMessage should have a documentation comment to explain its purpose, as per the style guide.1
| const kNoClientConnectedMessage = 'Recompile complete. No client connected.'; | |
| /// Message to show when a hot reload/restart is attempted with no clients connected. | |
| const kNoClientConnectedMessage = 'Recompile complete. No client connected.'; |
Style Guide References
Footnotes
-
All public members, including top-level constants, should have documentation comments. ↩
Impacted Users:
Flutter web developers using the
web-serverdevice for hot reload/restart.Impact Description:
Hot reload/restart crashes when the browser tab is closed, causing “Bad state: No element” errors and breaking the DWDS connection.
Workaround:
Rerun the app.
Risk:
Low — changes only affect hot reload/restart handling when no clients are connected.
Test Coverage:
Yes — covered by automated integration tests and verified with manual testing across reload/restart scenarios.
Validation Steps:
flutter run -d web-serverYou should see a warning
WebSocketProxyService: No clients available.along withRecompile complete. No client connected.printed in the console. The app should no longer crash.Merged PR: #177026
Changes in DWDS (Parent PR): dart-lang/webdev#2699
Fixes #174791