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] Convert account to session data explicitly #4446

Merged
merged 3 commits into from
Jun 18, 2024
Merged

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Jun 9, 2024

We were previously suppressing a type error which was a legit mismatch in types. We were assigning SessionAccount (an app concept) directly into agent.session as if it were AtpSessionData.

Strictly saying, this isn't valid — for example, refreshJwt can be undefined in SessionAcount but is expected to be a string (even if empty) in AtpSessionData. We do have a check (per suppression comment) that should rule out this actually happening but I think it's better to ensure this statically. This also avoids unrelated account fields like pdsUrl ending up attached to the session object.

This PR removes the suppression and adds an explicit conversion based on existing logic from the resume session codepath.

I don't expect this to change anything in practice.

Test Plan

Idk how to test this since it needs to trigger expiry. I think we need support from backend to force early expiry — with a header or something. So for now the test plan is just careful reading.

Copy link

render bot commented Jun 9, 2024

@gaearon gaearon marked this pull request as ready for review June 9, 2024 11:45
Copy link

github-actions bot commented Jun 9, 2024

Old size New size Diff
7.39 MB 7.39 MB 9 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.

Oh yeah great idea

@gaearon gaearon mentioned this pull request Jun 11, 2024
3 tasks
@gaearon gaearon merged commit 7ddbc39 into main Jun 18, 2024
6 checks passed
@gaearon gaearon deleted the session-tweaks-1 branch June 18, 2024 23:47
estrattonbailey added a commit that referenced this pull request Jun 20, 2024
* origin/main: (62 commits)
  Rework "Who can reply" to blend more nicely into the UI (#4578)
  Fix threadgate read after write (#4577)
  Convert button to use forwardRef (#4576)
  use 1000x1000 for image height in avatar cropper (#4453)
  fix for autofill covering border (#4573)
  Update HomeHeaderLayoutMobile.tsx (#4572)
  Option for large alt badges (#4571)
  Truncate post metrics and fix truncation on native (#4575)
  Fix avi placeholder layout (#4570)
  add support for `ListEmptyComponent`, allow `undefined` data (#4403)
  GIF previews in notifications (#4447)
  [Session] Convert account to session data explicitly (#4446)
  Move onboarding start to after successfull account creation (#4381)
  Collection of moderation fixes (#4566)
  Fix undefined block (#4479)
  fix gap between tab bar and its border (#4538)
  Better handling of blocks in `KnownFollowers` (#4563)
  Verify email reminders (#4510)
  Bump labeler limit to 20 (#4565)
  Migrate local thread mutes (#4523)
  ...
estrattonbailey added a commit that referenced this pull request Jun 20, 2024
* origin/main: (25 commits)
  Add a11y context (#4586)
  center pill text in label pill (#4579)
  Wait for AppView when posting (#4584)
  Bsky link card service (#4547)
  Merge #4492, fixes profile menu hover (#4580)
  Rework "Who can reply" to blend more nicely into the UI (#4578)
  Fix threadgate read after write (#4577)
  Convert button to use forwardRef (#4576)
  use 1000x1000 for image height in avatar cropper (#4453)
  fix for autofill covering border (#4573)
  Update HomeHeaderLayoutMobile.tsx (#4572)
  Option for large alt badges (#4571)
  Truncate post metrics and fix truncation on native (#4575)
  Fix avi placeholder layout (#4570)
  add support for `ListEmptyComponent`, allow `undefined` data (#4403)
  GIF previews in notifications (#4447)
  [Session] Convert account to session data explicitly (#4446)
  Move onboarding start to after successfull account creation (#4381)
  Collection of moderation fixes (#4566)
  Fix undefined block (#4479)
  ...
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.

None yet

2 participants