For context, I am using parse/react-native.js and have Parse.setAsyncStorage(AsyncStorage) and Parse.enableLocalDatastore() configured when initializing Parse.
I apologize for the unprofessional explanation in advance but I had no better idea how to formulate my question.
I have a cloud function (findWithFriendCode) that allows users to find other users via a “friend code”.
It takes in a friendCode (String) and after finding the corresponding user it returns a userProfile object of class UserProfile.
The userProfile object for now has two custom fields: user (Pointer <_User>) and displayName (String).
To test this function I create two new users “UserA” and “UserB”. When I sign in with UserA the app fetches the _User object of UserA to display account data (including email etc.) which might be of interest later. I then run the findWithFriendCode(friendCodeOfUserB) cloud function and it returns the expected result: userProfile of UserB including displayName and a _User Pointer. This result is also reflected on the client side in a console.log().
To test this the other way around I sign out UserA and sign in UserB within the same App. I run findWithFriendCode(friendCodeOfUserA) and the return value on the server side (server logs confirm this) is again as expected: userProfile of UserA including displayName and a _User Pointer.
However this time, the console.log() on the client side prints displayName and the complete _User object of UserA (including email etc.) instead of just the _User Pointer.
Testing again with UserA this time also includes the complete _User object of UserB even though the cloud function only returns a Pointer as expected.
So from these observations, my guess would be that on the client side Parse stores/caches objects that it has come in contact before (while fetching _User) and when encountering them again, automatically replaces Pointers with the actual object if it has been stored before.
Can anyone confirm if this assumption is correct?
If this is the case, is this behavior expected or is there a problem in the way I configured my app?
And if this behavior is expected, what can I do so the email address (which should be a protected filed: protectedFields: {"_User":{"*":[“email”]}}) of UserA is not revealed to UserB after switching accounts on the same installation?
From a privacy point of view this should not be much of a concern as this behavior is contained to two users using the same device which is an edge case but I’m interested in learning how Parse behaves or if I made a mistake somewhere.
Thank you!