Skip to content
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

fix(auth): wait to display Q sign-in notification #5632

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hayemaxi
Copy link
Contributor

(Super low risk and effort fix, but may not address the root issue due to difficulties to repro)

Problem

The sign-in notification is queued to display immediately after startup. Some users are reporting that it displays even if they are signed in. This may be due to the tryAutoConnection routine not having a chance to complete because of its async nature.

Solution

Put a delay on displaying the notification to users to potentially mitigate this issue.


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hayemaxi hayemaxi requested a review from a team as a code owner September 19, 2024 15:41
Copy link

This pull request modifies code in src/ but no tests were added/updated. Confirm whether tests should be added or ensure the PR description explains why tests are not required.

@hayemaxi hayemaxi force-pushed the signin-notify branch 2 times, most recently from f4cd1bb to d387b10 Compare September 19, 2024 15:49
(Super low risk and effort fix, but may not address the root issue due to difficulties to repro)

Problem: The sign-in notification is queued to display immediately after startup. Some users are reporting that it displays even if they are signed in. This may be due to the tryAutoConnection routine not having a chance to complete because of its async nature.

Solution: Put a delay on displaying the notification to users to potentially mitigate this issue.

// Display notification to sign if the user hasn't yet.
// Abitrary wait time to give the auth restore routine time to initialize.
globals.clock.setTimeout(() => void setupAuthNotification(), 5000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AuthUtil emits an onDidChangeActiveConnection event, is it possible we can wait for that to trigger and then we call setupAuthNotification?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it emit if there is no connection? That's when we would display the notification

Copy link
Contributor

@nkomonen-amazon nkomonen-amazon Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh true. Would it make sense to emit an event then when the restore logic is done? I'd think we'd want to avoid a using arbitrary timeout in general.

I see Justin's comment below and if we cannot add it to the tryAutoConnect due to the calls being disconnected or something, the event emitter method may be useful.

Copy link
Contributor Author

@hayemaxi hayemaxi Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replied to Justin; relevant to this chain.

@justinmk3
Copy link
Contributor

justinmk3 commented Sep 19, 2024

Can we make the "sign in notification" the responsibility of tryAutoConnect? After all, tryAutoConnect "always" runs (or if it doesn't, why?), so it can make the decision to show a "sign in" notification if needed.

@hayemaxi
Copy link
Contributor Author

Can we make the "sign in notification" the responsibility of tryAutoConnect? After all, tryAutoConnect "always" runs (or if it doesn't, why?), so it can make the decision to show a "sign in" notification if needed.

This method is resilient against other (un)expected auth behavior, not just tryAutoConnect. I suppose we can make it dependent only on the completion of that function and then re-evaluate if we still see it unexpectedly. This would increase our understanding of the auth flow as well.

@hayemaxi hayemaxi marked this pull request as draft September 19, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants