"Something went wrong while fetching comments" shows when browsing an issue with link to a specific comment
Steps to reproduce:
- Open an Incogninto window in Safari/Firefox/Chrome.
- Load https://gitlab.com/gitlab-org/gitlab-ce/issues/58499#note_149874737
In Firefox, I didn't see any 500 errors, but I did see 304 codes. I wonder if the XHR caching is confusing the frontend?
Findings
-
The main bug is that
handleLocationHash()
is called beforenotesData
is set. CausingdiscussionsPath
to be undefined and thus the error.This happens when you choose "Show comments only" or "Show history only" as discussion filter and then open a link to a specific note in an issue / MR. The code here attempts to switch you back to "All activity" and then the bug happens.
-
The other bug is when you're not logged in. For anonymous users we do not have a persisted value for the filter. But the initial selected value here is
null
instead of0
for default. So it goes through the process of switching to "All activity" even if "All activity" is the default option for anonymous users.