-
Notifications
You must be signed in to change notification settings - Fork 567
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
fix(utils): handle 0 as a reference value #325
Merged
+18
−8
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
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 looks like in the previous version a bad ref would result in this function returning "obj" (ref = obj on line 156, return ref here). Now it doesn't return anything if there's a bad ref. Don't know if this is good or bad, just wondering if it might have the potential to break something else.
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 point I forgot to mention that part. So I don't know why we were returning the whole object, if you look at line 91 we were testing for truthiness, which if we passed an object back would always be true. Then in line 131 we set
to_ret = ref
which would be that object as well and return it. This is inside a string.replace function, and returning an object does nothing to the string. So this was always "working", but not how we thought it was...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.
And hopefully all our glorious unit tests would catch anything major, but seems everything is in order.
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.
This file is so hard to understand - I'm concerned about the out-of-scope variable (updated_object) used within. I'm pretty sure I added the code that sets ref = obj as part of the work to provide better error output (although blame does not seem to think so), but I'm not clear how it interfaces with the updated_object variable.
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.
ok so updated_object is created immediate upon calling resolveObject. It is a deep clone of the object being resolved, to prevent any changes that are made during this process from trickling back outside the resolveObject scope. I think everything is ok as is...