Fix diff view on the /latest/ URL #120
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
qwc-open/asiakirjat!120
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/diff-view-on-latest"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #119. Using the compare / diff view from a
/project/{slug}/latest/page was broken: the "Showing changes from version …" header and Exit Diff View button didn't appear — only a faint amber background bar.Root cause (two compounding bugs)
Compare used the wrong version segment for path math. The compare handler computed the in-doc sub-path by stripping
/project/{slug}/{current}fromwindow.location.pathname, wherecurrentis the resolved tag (e.g.v1.5). On a/latest/URL the path actually containslatest, so the slice was off and the target-version fetch URL came out malformed → the diff fetch 404'd. (#119 switched the version-switcher and link-interception copies tourlVersion; this third copy was missed due to its indentation.)The error bar was mispositioned.
showErrorshowed the diff-indicator bar but — unlikeshowDiffIndicator— never set itstop, so it fell back to the CSS defaulttop:autoand rendered behind the main overlay. All you saw was the background sliver; the text and Exit button were hidden underneath.Bug 1 triggered bug 2 specifically on
/latest/, which is why it looked like an empty bar there.Fix
urlVersion(the segment actually in the URL —latestwhen served via the permalink), matching the other path-math sites. The diff fetch now resolves correctly and the success path (showDiffIndicator, which positions the bar below the overlay) shows the full header + Exit button.showErrornow setsindicator.style.top = overlay height, so any genuine error bar is visible too.One file,
static/js/overlay.js.currentis still used where the concrete tag is correct (compare target, download link). Worth a manual check on deploy: open a multi-version project at/project/{slug}/latest/, run a compare, confirm the header/Exit button appear and the diff loads.🤖 Generated with Claude Code