Race condition in `discussions.json` request could lead to notes showing inconsistently with selected notes filter
When a user has a discussion filter preference of "Show comments only" or "Show history only", and the user opens a link to a specific note, we switch the filter to "Show all activity".
If we look at the Network console, we see that two requests to discussions.json
are made:
- The original request with the user's persisted filter
- And another one made after switching to "Show all activity"
Depending on which request completes first, the resulting notes being displayed can be wrong. We expect the 2nd request to complete later because it is initiated a bit later but that is not always the case. When the 1st request completes after the 2nd, we now show filtered notes even if the filter was auto-switched to "Show all activity".
This becomes more visible when https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31229 is merged because previously a refresh would "fix" it because the filter is now set to all and both requests would return the same result.