This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($httpBackend): fixup patch for #9979 #9993
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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.
Why the
void 0
instead of 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.
smaller, can't be rebound accidentally
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.
Considering
undefined
is used throughout the code (in fact I'be never seen anyvoid 0
occurrence in the core), this just introduces inconsistency and leaves maintainers wonder what's special about this case.I am very surprised that this suggestion came from a maintainability advocate like you 😃
We should either change all occurrences to
void 0
or none.And considering that there are already meassures taken against rebinding
undefined
, I think usingundefined
is pretty safe.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.
I tend to agree with @gkalpak -
void 0
looks more "magical" and it is not the pattern we are using in the other parts of the code base. I would stick toif (timeoutId !== 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.
I would rather we change other cases of
undefined
tovoid 0
in the tree instead.void 0
is by definition an undefined value, but it's not a binding identifier, so accidents don't happen with it. That, and it's smaller. It's not something worth worrying about though, tbhThere 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.
@caitp I hear what you say but maybe let's focus on landing this PR open a separate issue / PR if care about reworking all
undefined
tovoid 0
.What do you think about my comment regarding tests? Do you want to land yours that is similar to the existing one or just change the counter to start from 0?
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.
I think ideally, the counter should just restart for each test case, it doesn't make a lot of sense to have it continue across tests, and it doesn't seem to be used very much in the tree. But I'd rather not worry about it for this CL
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 should we change
void 0
=>undefined
and land this one with the test you've created? I'm still a bit worried about its name / location in the file....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.
I don't see why.
I'm not, but if it makes you feel better it could be rearranged while landing.