-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
RFC: warn when returning different hooks on subsequent renders #14585
Merged
threepointone
merged 41 commits into
facebook:master
from
threepointone:wrong-hook-order
Jan 22, 2019
Merged
Changes from 38 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
4d8a8cf
warn when returning different hooks on next render
0daee73
lint
623fb58
review changes
1204a0c
cleaner detection location
d597fcd
redundant comments
1c7314f
different EffectHook / LayoutEffectHook
5221e91
prettier
bcbce28
top level currentHookType
a604ea1
nulling currentHookType
8b22c87
small enhancements
95aa003
hook order checks for useContext/useImperative
cbf4068
Merge branch 'master' into wrong-hook-order
4676b6b
prettier
5a94b54
stray whitespace
aca87cd
move some bits around
428a3eb
better errors
6cd966c
pass tests
13debbb
lint, flow
65ebacb
Merge remote-tracking branch 'upstream/master' into wrong-hook-order
9bd7051
show a before - after diff
0eea976
Merge remote-tracking branch 'upstream/master' into wrong-hook-order
f09966d
an error stack in the warning
e366069
lose currentHookMatches, fix a test
d8c4236
tidy
4801b12
clear the mismatch only in dev
c77e448
pass flow
b6fb3ca
side by side diff
055ebf6
tweak warning
c7a872b
Merge remote-tracking branch 'upstream/master' into wrong-hook-order
e06b72b
pass flow
190e9b1
dedupe warnings per fiber, nits
f37f4fd
better format
26fd179
Merge remote-tracking branch 'upstream/master' into wrong-hook-order
3e8a217
nit
c2d686a
Merge remote-tracking branch 'upstream/master' into wrong-hook-order
f493675
fix bad merge, pass flow
a985e72
lint
1621a2d
missing hooktype enum
5ecda4c
merge currentHookType/currentHookNameInDev, fix nits
d4860ca
lint
3ad6523
final nits
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
Oops, something went wrong.
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.
I'd write these as switch so that the 1:1 correspondence is clear, and also so that we can (type) check if is exhaustive,
HookType -> string
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.
ugh I missed this, will get to in a bit
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 thought about this, and maybe I don't think this is critical? we're not planning on changing this list anytime soon, and it'll add complexity.
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.
Not saying this is critical but I'm also not sure how this will add complexity.
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.
didn't want to add extra function calls and the comparisons when it was readily indexed and available here.