Error banners like "Failed to fetch comments", etc.. constantly show up in MRs even when they were loaded successfully.
I can reproduce by reloading the page and switching to another tab while the requests are going on. When I switch back, I see the error even though the comments are loaded fine.
I wonder if we should make failures on polling more silent or at least distinguish them from first load (which would cause the comments not showing in the first place9?... Paging @pedroms.
I wonder if we should make failures on polling more silent or at least distinguish them from first load (which would cause the comments not showing in the first place9?
@andr3 agreed. And the alert should be at the top of the comments area, not affecting the whole MR page in my opinion.
Yeah, I can't reproduce there either. Can you try !32282 (merged)?
I just started a new pipeline here and then the problem started happening. I noticed that it only works if I switch back to the tab after the favicon changes to the pipeline running icon.
Also, no related errors in the console tab, and the network tab seems okay too:
$ gg -n "Something went wrong while fetching latest comments."app/assets/javascripts/notes/stores/actions.js:408: .catch(() => Flash(__('Something went wrong while fetching latest comments.')));app/assets/javascripts/notes/stores/actions.js:421: errorCallback: () => Flash(__('Something went wrong while fetching latest comments.')),
I think I've seen this appear on issues as well - can you confirm? Also, do we have any leads on a potential fix?
I see this in issues sometimes but I cannot reproduce. For MRs, I can reproduce sometimes for a specific MR, but after a while it doesn't happen anymore. Like if I did the same thing to the MRs I linked above, I don't see the problem anymore.
I'm not sure how the error callback ended up being called there even without any requests with errors but there are only 2 places where this specific error message is used and both of them are triggered from this block of code so this must be where the problem is.
I also saw a commit around the same time that this started happening: 65c4eabf from !25867 (merged)
This was deployed to production on March 10 and I created this issue on March 13.
In that MR, the requests here were changed to use Axios. But I'm not sure how that would cause the problem.
I have seen this happen intermittently on some MRs and my suspicion is that it is aggressive tab suspension which kicks in the moment you switch to different tab before previous tab is done loading fully. Right now the logic behind showing banner is generic and will execute for any reason that caused request to fail/cancel. I think an ideal fix for this is to determine whether tab is in foreground before showing any errors regardless of how request was treated.
@engwan@kushalpandya I just had this happen to me right now when I loaded an issue. In this case I opened the issue by middle clicking the back button of my Chrome browser to get back to this issue in a new tab.
@kushalpandya maybe also adding a retry of some kind?
Also, why not handle the comments error and show it in the discussion area with a Retry button? That way it can be styled with a visual attention level proportional to the error.