Skip to content

fix(web): preserve link labels in content diffs - #683

Merged
pikann merged 1 commit into
Paca-AI:masterfrom
Yushu-Li:fix/content-diff-link-text
Nov 1, 2026
Merged

pikann merged 1 commit into
Paca-AI:masterfrom
Yushu-Li:fix/content-diff-link-text

Conversation

@Yushu-Li

@Yushu-Li Yushu-Li commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Editing the text of a link in a document or task description can show “no differences” in the version diff: blockNoteToLines reads only top-level text nodes and drops BlockNote link labels.

I include link labels in inline order, including styled text arrays and legacy string labels, while keeping nested block traversal. The diff remains a plain-text comparison: URL-only and formatting-only changes are outside its scope. No URL is rendered as an active link.

Type of Change

  • Other: frontend bug fix with regression coverage.

Validation

  • Seven new utility/component cases; six fail on the original source, one existing-behavior control passes.
  • Focused diff and real React ContentDiff tests: 13 passed.
  • Full web suite: 140 files, 1,408 tests passed.
  • bun --bun run lint and bun --bun run build passed, including TypeScript checking. Lint retains three warnings in untouched files; the build retains its large-chunk warning.

No authenticated full-stack end-to-end test was run. The component checks render the actual ContentDiff in jsdom. No dependency, API, database, or localization changes.

Checklist

  • The change is focused and scoped.
  • Related behavior and limits are explained above.
  • Regression tests cover changed behavior.
  • I avoided unrelated refactoring.

AI assistance: I used OpenAI Codex for implementation, tests, and automated review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Link labels in text extraction — blockNoteToLines now delegates to a new recursive inlineContentToText, which joins text nodes with link labels (array content recursed, legacy string content returned verbatim) and ignores other inline types, fixing the "no differences" result when a link's label is edited.
  • InlineContent shape — widened with content?: InlineContent[] | string to model current styled-text link content plus the legacy string-label form; the existing type: "text" branch already covered the styles.link representation, so both are now handled.
  • Unit coverage — new diff-utils.test.ts cases for inline ordering, nested blocks, legacy labels, label edits producing removed/added lines, URL/style-only changes staying unchanged, and empty/non-text blocks.
  • Component coverage — new content-diff.test.tsx renders the real ContentDiff in jsdom and asserts changed and deleted link labels are shown instead of the empty state.

The plain-text, line-level diff contract is preserved (URL-only and formatting-only changes stay invisible), recursion operates on acyclic serialized JSON, and content-diff.tsx remains the only consumer of the changed helpers. No actionable issues found.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pikann pikann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution! 🚀

@pikann
pikann merged commit 2cac8f5 into Paca-AI:master Nov 1, 2026
2 checks passed
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.

2 participants