-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix(HMS-2261): show warning when polling reservation fails #294
Conversation
/retest |
LGTM |
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.
Will this happen on first failure? If this would be on first failure, I would consider this confusing.
Also while trying to verify the above Q, I've hit https://tkdodo.eu/blog/breaking-react-querys-api-on-purpose which says the callbacks are not great way to do things and are deprecated in React Query v4. I guess you will make more sense out of whether we care or not, but they seem to think that using it for state management is a bad idea 🤷 :)
Also the commit message is missing the delimeter ( |
@ezr-ondrej,
I'm not sure if I understand, could you explain? Thanks for this blog post, we definitely need to start migrating our react-query 👍 Another solution here is using the timeout warning (but it is a bit odd to spam our backend with 404 / 500 until a timeout is reached) |
Yeah you don’t have the context: @avitova figured out that if backend returns 404 (e.g. reservation is deleted somehow) the UI gets stuck because it tries to fetch /reservations/ID over and over again. It never stops. It is a valid bug, we should be checking HTTP codes thus this PR. |
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.
Oh, I guess I understand now :)
The thing I'm worried about is if this sets an error on first failure (that react-query usually recovers from if that's just network issue, won't this completely stop the process, because now we set warning and thus stop polling?
I agree this is kinda ok solution for now, until we will need to migrate to newer react-query, but I'm just worried we break other cases here. Not every error should stop the polling immediatly, right? |
Examples? |
@ezr-ondrej this change does not break the polling at the first attempt, there are 3 attempts by default, and only than the error raise. We can increase the retries as we wish https://tanstack.com/query/v4/docs/react/guides/query-retries |
updated commit message. |
/retest |
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.
In that case, perfect! thank you! 🙏
When the reservation polling fails after a few attempts, (status != 200), the reservation was created already successfully, but there is no way to fetch the current launch status, this PR adds a warning , something like: