"Show/Hide whitespace changes" button resets diff view mode
Summary
When loading a diff with a view mode given in the URL (e.g. ?view=inline
), and then switching the view mode via the button, the "Show whitespace changes" (or "Hide whitespace changes") button resets the view to the one from the URL.
Steps to reproduce
- Load a diff with a view mode in the URL
- Click the opposite view mode button
- Click the "Show/Hide whitespace changes" button
Example Project
This bug is reproducible on GitLab.com:
- Load
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/7834/diffs?view=inline
– note the view mode in the URL parameter. - Click "Side-by-side"
- Click "Hide whitespace changes"
What is the current bug behavior?
The diff view is reset to inline mode
What is the expected correct behavior?
The diff view mode remains on the selected "Side-by-side".
Output of checks
This bug happens on GitLab.com
Possible fixes
I think this happens because the URL for the "Show/Hide whitespace changes" button is calculated on page load and not updated when the view mode is switched later.
This issue is related to the other "URL of the whitespace button" ones:
Edited by Henning Hoefer