[Session] Call persist handler directly #3828
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extracted from #3728.
This is a plain refactor, no change in functionality. We had a bunch of indirection that turned out to be unnecessary and that made it way harder to read what this code is actually doing. This removes the indirection.
Concretely,
networkErrorCallback
was always specified to beclearCurrentAccount
, andpersistSessionCallback
was always specified to beupsertAccount
. So this inlines those calls directly and removes the configurable parameters.There are likely some fixes and simplifications we can do on top but let's get this in first.
Test Plan
This is a bit tricky to test because you need to trigger one of the conditions that get us into the persist handler. One of those is the initial update when resuming a session. So what I've done is:
You can also just read the code with whitespace off and verify it's a mechanical transformation.