-
Notifications
You must be signed in to change notification settings - Fork 37
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
Rewrite queue page with hooks #263
Conversation
This pull request is automatically deployed with Now. |
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.
Add a changelog entry, and we should be good to go!
Also tested this on Now with Eddie's iPad - it correctly reports that the socket is disconnected, then connecting, then connected again after the device is awoken from sleep. |
My hope is that this rewrite will help eliminate the 404s we've been seeing at random. My best guess (or, hunch, really) as to why it's happening is a race condition of some kind, which hooks are better at avoiding. We also explicitly maintain our own loading state in the component. Again, this is just a hunch, and we'll have to see if the anecdotal reports of 404s stop after this.Turns out my initial hunch was totally wrong. Eddie figured out how to reproduce the 404 bug:
It appears as though Safari kills socket connections when Safari isn't in the foreground. When that would happen, we'd get an error event, which (due to my bad error handling) would cause another error. That error would get picked up by React and rendered as our custom error page by Next.js. Unfortunately, our custom error page didn't work well for this use case, because it would default to showing a misleading 404 if a status code wasn't present on the error (which it wasn't, in this case).
So, this PR does a few things to address these issues:
Given the context of the original problem, would be awesome if people have iOS devices to test with.
Also fixes or enhances a few other things:
id
s ofactiveStaff
models weren't being included in the "get queue" response; adds test to prevent future regressions