Repository navigation
Reduce some firebase reads on homepage for logged-in users - #590
Merged
Merged
Conversation
Member
|
Great catch! Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
After mentioning that firebase reads were one of the costly things about hosting, I had a look around for any quick wins, particularly on the homepage.
This is a change for logged-in users only:
Currently, if a user has not played a puzzle on the homepage (the usual case, I'd imagine), it will either:
undefined. It doesn't know whether the user has played the puzzle. So it will go request the status.null. This is practially a negative cache - i.e. We know the player has not played the puzzle.However, the third state is incorrectly grouped with the first, and so it goes and requests the status. And then the read is empty (as it had warned).
This PR changes the third state so that we accept the
nullstate and don't go and request the play data, because we know it wont be there.Although this is a tiny change, it is not straightforward, so I'd appreciate a double-check of my logic.