-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
RN: Add error handler on WS to fix crashing on page reload #3002
Conversation
lib/channel-websocket/src/index.js
Outdated
@@ -52,6 +52,8 @@ export class WebsocketTransport { | |||
this._handler(event); | |||
}; | |||
this._socket.onerror = e => { | |||
// Ignore network errors like `ECONNRESET`, `EPIPE`, etc. | |||
if (e.errno) return; |
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 will also catch connection errors like ECONNREFUSED
, not sure if wanted.
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.
What would be the proper filter to only catch chrome tab reload?
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.
Is WebSocket
here the browser native WebSocket
object or ws
or it depends on the context?
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 this is the browser WebSocket
as per https://github.com/storybooks/storybook/pull/3002/files#diff-432fa23ac718b94ed5be1b2802371d41R3. In this case you don't need this, the fix on the server is sufficient and correct.
Codecov Report
@@ Coverage Diff @@
## master #3002 +/- ##
==========================================
- Coverage 37.3% 37.29% -0.02%
==========================================
Files 435 435
Lines 9432 9435 +3
Branches 883 896 +13
==========================================
Hits 3519 3519
- Misses 5379 5394 +15
+ Partials 534 522 -12
Continue to review full report at Codecov.
|
saw you denied the two screenshot changes. is that because of the async nature of screenshots or is this PR not ready to go yet? |
Apologies again about these flaky tests. I hope to have it sorted out in the next 24-48 hours. More than happy to revert the PR that added them in the meantime. |
@tmeasday does the screenshots happen when There was one I just fixed in my other PR where the early blank screenshot was set as the correct test set. I don't think it's a huge issue but maybe your other customers might mind if the timing is off. |
@danielduan in this case it is due to the stories rendering an iframe, which we then need to wait to load. You can read more detail about what's happening here: #2958 |
RN: Add error handler on WS to fix crashing on page reload
could you someone publish 3.3.14 to npm? - many thanks |
It's actually published:
If you're behind a corporate proxy, you may need to wait until it updates its cache |
Issue: #2923
What I did
Added error handling according to websockets/ws#1256 (comment)
How to test
Launch CRNA example, refresh desktop browser tab (it should be Chrome)