-
Notifications
You must be signed in to change notification settings - Fork 895
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
Firestore: local_serializer.ts: change toDbIndexState() argument from user:User to uid:string #7909
Conversation
…m user:User to uid:string
|
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
@@ -131,7 +131,7 @@ export class IndexedDbIndexManager implements IndexManager { | |||
(l, r) => targetEquals(l, r) | |||
); | |||
|
|||
constructor(private user: User, private readonly databaseId: DatabaseId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share with me why private
is removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because the User
argument is no longer stored in a property; instead, its "uid" is stored. Therefore, removing the private
makes it no longer a property on the object but rather just an argument to the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This PR makes a tiny change to an internal function named
toDbIndexState()
. Formerly, this function had aUser
argument, of which only theuid
property was used. If the given user was unauthenticated, then the empty string was used instead. This, however, is an implementation detail of the single call site which uses an empty string as the "uid" of an unauthenticated user.To avoid this implementation detail bleeding into the
toDbIndexState()
function, this PR changes the argument from aUser
to simply astring
, whose value is the "uid" to use. The caller, then is responsible for mapping the unauthenticated user to the correct string, keeping that implementation detail in one place.This PR does not actually change any functionality, but merely cleans up the code a bit.