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] Extract resumeSession out #3811

Merged
merged 1 commit into from
May 2, 2024
Merged

[Session] Extract resumeSession out #3811

merged 1 commit into from
May 2, 2024

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented May 2, 2024

resumeSession is a thin wrapper over initSession which sets setIsInitialLoad(false) to hide the splash and then becomes effectively the same as initSession. I was wondering if I could get rid of it, and the only usage of resumeSession was from top-level InnerApp components which, conveniently, were the ones who needed isInitialLoad in the first place (to hide the splash). So I removed resumeSession from the Session API and removed isInitialLoad from its context.

Why?

I want to pare it down, and resumeSession doesn't depend on any knowledge that isn't already available through the Session API. So it made sense to me to move it out to keep that code more focused. Conceptually we have one instance of the InnerApp component (it's just forked between two platforms). The local usage also makes sense because it lets us get rid of context for something that's really a very local thing that only one component cares about.

Test Plan

Verify splash screen still gets hidden on session init. Verify switching users still works.

Copy link

render bot commented May 2, 2024

}, [initSession])

useEffect(() => {
return listenSessionDropped(() => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed to return the unsub, I think this was previously leaking.

Copy link

github-actions bot commented May 2, 2024

Old size New size Diff
6.85 MB 6.85 MB -530 B (-0.01%)

Copy link
Contributor

@haileyok haileyok left a comment

Choose a reason for hiding this comment

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

Encountered the incorrect pinned feeds issue once when switching back and forth between accounts, but appears to be the existing issue rather than a new one. Switching accts works, and account is loaded before splash disappears (tested just setting isReady to false and watched the logs).

@gaearon gaearon merged commit 5ec945b into main May 2, 2024
6 checks passed
@gaearon gaearon deleted the session-detour-1 branch May 2, 2024 17:17
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