Mark as viewed stays checked in Single File Mode
Problem to Solve
When using the mark file as viewed feature, the viewed checkbox is persisted across files when reviewing in file-by-file mode.
Proposal
Viewed
status should be respected on each file when doing file-by-file review.
Cause
The check for whether a file should be "reviewed" (and collapsed, in this case), is toggled when the DiffFile
component is mounted.
In file-by-file mode, the component is only mounted once, and then the diff file is swapped when moving among files.
There also seems to be a problem with sending the reviewed
status to the file itself at the app level. It's most likely that the app is always interacting with "the first index" (since the single-file view is always index 0), but the reviews have many reviews per MR. That's just a guess, but the reviewed
property doesn't seem to be updating when you cycle through files.
Fix
The first fix will be to move this check, in the mounted
callback for the diff file into a 'file.id'
listener in the watch
section of that component.
The second fix will be for the checkbox itself, and is a bit more complicated.
The reviewed
property is provided to the DiffFile
by the Diffs app. The available reviews are computed based on what files are loaded into the app at any given time, and then passed into the file itself as whether it's been reviewed
(or not). This seems to not be updating when navigating between individual files, which may require a tiny bit of investigation and moving this logic somewhere at a higher level (potentially into Vuex).