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

[Session] Rely on agent session change event for persisting resumed session #3836

Merged
merged 2 commits into from
May 3, 2024

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented May 3, 2024

Extracted from #3728.

See two individual commits.

  • 7095822: When we resume session, we don't want to block the UI so we assume it'll come through. Still, we kick off a resumeSession request in background. When that request comes back, we want to persist the new session if it's different from what we've stored. Turns out, we don't actually need to write this logic explicitly because the onAgentSessionChange handler already has the logic to handle session updates — and the agent will call it. So just kicking off a resume is sufficient on its own. Errors would be reported to onAgentSessionChange as well.
  • 529d1fe: Previously, we had an optimization that avoids a state update right after startup if the resumed session is the same as what we've stored. We've lost this optimization in the last commit so let's re-add it here.

Test Plan

  1. Toggle 2FA setting in a different browser window.
  2. Reload and observe that the change is being picked up on resume via onAgentSessionChange.
  3. Reload and observe that next resumes are able to bail out of the setState due to identical payload.

Copy link

render bot commented May 3, 2024

Copy link

github-actions bot commented May 3, 2024

Old size New size Diff
6.86 MB 6.86 MB -304 B (-0.00%)

Copy link
Member

@estrattonbailey estrattonbailey left a comment

Choose a reason for hiding this comment

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

🔥

@gaearon gaearon merged commit cdf7a19 into main May 3, 2024
6 checks passed
@gaearon gaearon deleted the session-resume-rm branch May 3, 2024 02:47
estrattonbailey added a commit that referenced this pull request May 3, 2024
* origin/main:
  make service url gate friendlier (#3841)
  remove broken keyboard offset code (#3842)
  [Clipclops] Header tweaks (#3839)
  update date logic to account for timezones (#3840)
  [Clipclops] Moar error (#3837)
  [Session] Reset global agent on expire (#3838)
  [Session] Rely on agent session change event for persisting resumed session (#3836)
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.

2 participants