Skip to content

Integrate semantic page comparison - #2697

Closed
hweihwang wants to merge 2 commits into
nextcloud:mainfrom
hweihwang:review/collectives-version-comparison
Closed

hweihwang wants to merge 2 commits into
nextcloud:mainfrom
hweihwang:review/collectives-version-comparison

Conversation

@hweihwang

@hweihwang hweihwang commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

In one sentence: Collectives now opens the Text semantic comparison when comparing page versions, with the old Viewer path kept as fallback.

What and why

Comparing two versions of a page today opens both documents in Viewer, side by side, with no highlighting. That is two documents in one window, not a comparison. This PR wires Collectives to the semantic comparison Text now provides — and keeps the old path working where it must.

What's in this PR

  • A version-pair model and a dialog that loads both snapshots before mounting either side — a half-mounted comparison looks like a comparison and is not one
  • Capability detection (a function check, not a version pin) with the existing Viewer fallback unchanged
  • Explicit refusal on mobile, where the fallback could only show one document
  • An edit-mode lifecycle fix in its own commit (see below)

The existing stock Viewer fallback: two documents, no highlighting
The new comparison dialog: 25 grouped semantic changes with before/after previews
The whole argument for this PR: the same pair, before and after. The fallback still works — it's just no longer the comparison experience.

Mobile: explicit unsupported message instead of one document posed as a comparison
On mobile the dialog refuses rather than degrade. The dialog keeps full height, so most of the image is empty — that's real modal behaviour.

Design notes

  • The compatibility fix. Upstream b7042764 made the isTextEdit watcher async and added member loading inside it; combined with this branch's lazy editor creation, a member request still in flight could create an editor after edit mode ended — and a hidden editor can write back stale content over a version restore. ensureEditor() now reuses one in-flight setup promise, runs setup in parallel with member loading, and destroys the editor if edit mode ended during setup. A browser test holds both async paths, leaves edit mode, then restores a version and confirms the restored content survives.
  • Version freshness moved to the versions tab, so comparing right after a save can't request a revision the server never had.

Stack

Requires the Text stack: nextcloud/text#9043 → #9044 → #9045 → #9046 (all four merge and release first). Followed by #2698. Review focus: src/components/Page/TextEditor.vue, src/composables/useEditor.ts.

Verification

lint (tsc + eslint) passes; unit suite 26/26. Recorded live end-to-end runs at this tip: NC35 28/28 and NC34 28/28 (stock Viewer 8b68b1bd). A fresh pass with current Viewer master (33dc36ba) is due before this leaves draft — the stack uses the stock compare() API, so no Viewer change is involved.

AI assistance

Commits carry Assisted-by: Codex:gpt-5.6-sol; an independent review pass was run with Claude Opus 5, who flagged the stale stock-Viewer commit in the earlier E2E record. Description drafted with Hermes (deepseek-v4-pro) from my notes, then reviewed by me.

Related

No closing keyword — the stack completes this issue at the final unit.

Normalize version chronology, quarantine invalid selector identities, load both snapshots atomically, and cache only immutable successful historical content.

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
Expose comparison actions, preserve the desktop Viewer fallback, reject mobile one-pane fallback, and mount the Text comparison only after both snapshots load.

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant