-
Notifications
You must be signed in to change notification settings - Fork 387
Fix bug that was causing duplicate keys in sessions #1310
Conversation
(associatedUserObj.associated_user.id = Number(value)), | ||
]; | ||
associatedUserObj.associated_user.id = Number(value); | ||
return [key, undefined]; |
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.
Would we need to filter these undefined values? Having all of this in the switch inside the map does make it a bit hard to follow. I wonder if we should change this last map
call to just directly access all of the fields? 🤔
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.
Yeah, this function is very confusing which is part of the reason I missed this at first.
I agree with a bit of a refactor.
…rtyArray, when returnUserData = true Refactor fromPropertyArray Remove console Cast to any
2f6d120
to
96a0aab
Compare
We currently allow extra fields to be passed in
Boolean(value); | ||
break; | ||
} | ||
case 'emailVerified': | ||
if (returnUserData) { | ||
sessionData.onlineAccessInfo.associated_user.email_verified = | ||
sessionData.onlineAccessInfo!.associated_user.email_verified = | ||
Boolean(value); | ||
break; | ||
} |
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.
Looks good! One last question - can we replace setting the prototype of sessionData
in line 137 with creating an actual Session
instance? Not a blocker if we can't!
WHY are these changes introduced?
We were returning duplicate keys in the Session when using the new returnUserData flag, with the FromPropertyArray. I don't believe this should be causing any issues, because the key were also being added to the correct position in the object.
WHAT is this pull request doing?
Type of change
Checklist
yarn changeset
to create a draft changelog entry (do NOT update theCHANGELOG.md
file manually)