-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
Improve the warning given when using channel before it's defined #1515
Conversation
LGTM, ready to merge @tmeasday |
Merge to |
Ow I didn't notice this isn't actually based on master. In that case, we first need to rebase on master, or merge into it's current base, and proceed from there. This particular change look good to me, I haven't seen #1509-fix-react-native-example |
That's been merged I think. Let me mess with the PR |
Codecov Report
@@ Coverage Diff @@
## master #1515 +/- ##
==========================================
- Coverage 20.84% 20.82% -0.02%
==========================================
Files 251 251
Lines 5575 5579 +4
Branches 668 669 +1
==========================================
Hits 1162 1162
- Misses 3900 3903 +3
- Partials 513 514 +1
Continue to review full report at Codecov.
|
We need to check for the channel exception on both sides of the channel.
We missed this as part of #1515
This causes that my tests fail because I do: |
@usulpro -- why does it fail? In what context? Storyshots? |
@tmeasday it fails if I run Jest test which imports this file. Actually I already have fixed this just by removing this line inside the not covered code |
A Jest test -- is it storyshots or something else? If something else perhaps it needs to setup a fake channel like SS does? |
I faced it in #1501 (addon-info) |
Yeah i'm not sure. I couldn't figure out a better way to warn people about the Fake/mock channel seems pretty reasonable. With jest you can do it with one line I reckon. |
With 4.0 I will change channel to be a Promise |
Issue: #1514 fixed an issue where a "fake" channel that threw a warning broke RN. This left us without a warning
What I did
Instead, let's throw directly and check for that in the RN initializer.
How to test
Check RN-vanilla, plus general testing (CI + CRA-ks).
Note
This is targeted to #1514, we should change the target when that is merged.
Sometimes it's possible things grab the channel and don't access it, which might be a problem.
Another approach would just be to log a warning rather than throwing.