Page MenuHomePhabricator

Differential revision page diff sometimes shows file diffs without visible differences
Closed, ResolvedPublic

Description

(observed on Phacility)

When reviewing a revision in Differential, the diff for some files sometimes shows not difference at all like here:

pasted_file (477×1 px, 147 KB)

However, the diff section is not collapsed, but expanded. So you have an expanded diff section with no visible difference between left and right sides, and no explanation either as to why things look like that, which is confusing.

I assume it might be because there is only whitespace changes? If so, why not collapse the section, and use an explanation like "The diff for this file only contains whitespace changes."?

Event Timeline

There's an inline comment, visible in the left margin of the left-hand diff. You previously collapsed it.

Ah I was wondering about this comment, but since it was explicitly hidden, I thought it wasn't the cause.

Why not collapsing the diff in this case?

epriestley claimed this task.

Why not collapsing the diff in this case?

It's technically simpler to leave the context expanded because we don't have to write any special code: hidden inline comments are still inline comments, so this was the default behavior when hiding was implemented.

It's also technically simpler to leave the context expanded because this means that inline comment anchors always correspond to a target which exists on the page. If we sometimes hid the context for inline comments, anchors like #inline-123 would sometimes need to trigger an Ajax query to expand context so we could jump you to the anchor. There's also no easy way for Javascript to figure out which changeset a given inline corresponds to, so we'd need to publish a map or make an additional lookup request on top of this. Our anchor behavior today isn't ideal, but it's much better for these comments than it would be if we collapsed the context.

The goal of the "Hide" interaction was to let users get comments out of the way while reviewing a diff, particularly after the ghost inlines feature introduced more comments in inline threads. It is intentionally lightweight, and isn't intended to mean "completely hide this comment forever". For example, it does not affect the comment in the transaction record. You can find more discussion of this in T7447. Leaving the context expanded is consistent with the lightweight goal of the product interaction.

OK I understand. Even if the current UX is not perfect, if implementing an improved version would result in a more fragile UX because the code is a lot more complex, then yes, the current situation is preferable.