-
Notifications
You must be signed in to change notification settings - Fork 351
Fix bug where you could trigger simultaneous connects by accidentally clicking or pressing return twice #3114
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
Conversation
'The "$page" screen is not available for this application.'), | ||
page != null | ||
? 'The "$page" screen is not available for this application.' | ||
: 'No tabs available for this application.', |
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.
This should now never occur but the previous message was confusing.
@@ -117,7 +117,7 @@ class _InitializerState extends State<Initializer> | |||
|
|||
/// Shows a "disconnected" overlay if the [service.serviceManager] is not currently connected. | |||
void _handleNoConnection() { | |||
WidgetsBinding.instance.addPostFrameCallback((_) { | |||
WidgetsBinding.instance.scheduleFrameCallback((_) { |
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.
I don't understand why we were using a postFrameCallback. A frame might not render and then it wouldn't be called till some strange later time.
@@ -1305,3 +1281,18 @@ extension BoolExtension on bool { | |||
return -1; | |||
} | |||
} | |||
|
|||
Future<T> whenValueNonNull<T>(ValueListenable<T> listenable) { |
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.
I don't see where this is used in this PR?
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.
it is used in a future pr.
if (value != null) { | ||
completer.complete(value); | ||
} | ||
listenable.removeListener(listener); |
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.
what if value
is null? Then we would remove the listener and the completer would never complete. If value
is null, should we keep listening?
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.
agreed. Fixed the logic.
The previous approach of delaying by 250ms was insufficient. This matches other UI in DevTools where we block actions while the current action is in progress.