-
Notifications
You must be signed in to change notification settings - Fork 76
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
Protect against undefined values #228
Conversation
@@ -66,7 +66,7 @@ const provider = { | |||
multiSet(pairs) { | |||
const stringifiedPairs = _.map(pairs, pair => [ | |||
pair[0], | |||
JSON.stringify(pair[1]), | |||
JSON.stringify(pair[1] || null), |
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.
Let's only short circuit to null
in the case of an explicitly undefined
value? Anything falsy will default to null
with what you have here. It might be fun for a while, but will probably lose it's charm quickly 😄
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.
Oh, good call.
OK, updated. Here is the output of
|
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.
Code makes sense to me! Will leave to @marcaaron to push the button
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.
LGTM 👍 thanks for catching this one!
cc @marcaaron @chrispader
Details
Explained in this thread: https://expensify.slack.com/archives/C01GTK53T8Q/p1673550288930829
This caused a crash in the app when clearing Onyx due to one of the values passed to
multiSet()
being undefined (which is normal behavior for a value that we are trying to clear out).Related Issues
None
Automated Tests
None
Linked PRs
This will be tested and deployed with Expensify/App#13886