Skip to content

Remove inline style attributes from Yorkie Tree on clear#304

Merged
hackerwins merged 1 commit into
mainfrom
fix/docs-unlink-href
May 25, 2026
Merged

Remove inline style attributes from Yorkie Tree on clear#304
hackerwins merged 1 commit into
mainfrom
fix/docs-unlink-href

Conversation

@hackerwins

Copy link
Copy Markdown
Collaborator

Summary

Clicking unlink in the docs editor did nothing — the hyperlink stayed.

removeLink clears the link via applyInlineStyle(range, { href: undefined }), but the Yorkie store (yorkie-doc-store.ts) only wrote styles with tree.styleByPath, which merges attributes and can never delete one. serializeInlineStyle also drops undefined keys, so the clear was silently lost and the href survived on the Tree node (the CRDT source of truth). The optimistic in-memory cache removed it, so the link looked gone locally until the next tree re-read (remote change / reload) — and never disappeared for other collaborators.

This is exactly the gotcha already handled in setBlockType and updateTableCellSpan ("styleByPath merges, not replaces" → use removeStyleByPath), but the inline applyStyle path missed it.

Fix

applyStyle now computes the Yorkie attribute names of any InlineStyle key explicitly set to undefined (removedInlineStyleAttrs) and calls tree.removeStyleByPath per styled inline, alongside the existing styleByPath merge. The inline path range matches the established single-node removal pattern. General fix: covers any cleared key, not just href.

Test plan

  • New tests in tests/app/docs/yorkie-doc-store.test.ts ("applyStyle attribute removal"):
    • clears href from the Tree when applyStyle gets { href: undefined }
    • keeps other styles (bold) when only href is cleared
    • both assert against a fresh re-read from the CRDT tree (new YorkieDocStore over the same doc), not the optimistic cache
  • Confirmed the tests fail on the unfixed source and pass with the fix.
  • pnpm verify:fast green (lint + all unit tests); pre-push verify:self (all build lanes + entropy) green.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@hackerwins, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 7 minutes and 28 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd2068fc-a5fb-4bb4-8485-dbd7a56ebb4f

📥 Commits

Reviewing files that changed from the base of the PR and between 448a711 and 04d1ae9.

📒 Files selected for processing (5)
  • docs/tasks/README.md
  • docs/tasks/active/20260526-docs-unlink-href-lessons.md
  • docs/tasks/active/20260526-docs-unlink-href-todo.md
  • packages/frontend/src/app/docs/yorkie-doc-store.ts
  • packages/frontend/tests/app/docs/yorkie-doc-store.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/docs-unlink-href

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Docs unlink did nothing because removeLink clears the link via
applyInlineStyle(range, { href: undefined }), but the Yorkie store
only wrote styles with tree.styleByPath, which merges attributes and
can never delete one. serializeInlineStyle also drops undefined keys,
so the clear was silently lost and the href survived on the Tree node
(the CRDT source of truth). The optimistic in-memory cache removed it,
so the link looked gone locally until the next tree re-read and never
disappeared for other collaborators.

applyStyle now computes the attribute names of any InlineStyle key
explicitly set to undefined and calls tree.removeStyleByPath per styled
inline, mirroring the existing setBlockType / updateTableCellSpan
removal pattern. General fix: covers any cleared key, not just href.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@hackerwins
hackerwins force-pushed the fix/docs-unlink-href branch from f53fb0b to 04d1ae9 Compare May 25, 2026 16:16
@hackerwins
hackerwins merged commit 057e196 into main May 25, 2026
1 check passed
@hackerwins
hackerwins deleted the fix/docs-unlink-href branch May 25, 2026 16:16
@github-actions

github-actions Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Verification: verify:self

Result: ✅ PASS in 232.0s

Lane Status Duration
tokens:build ✅ pass 2.2s
sheets:build ✅ pass 13.1s
docs:build ✅ pass 12.2s
slides:build ✅ pass 14.1s
verify:fast ✅ pass 148.4s
frontend:build ✅ pass 18.4s
verify:frontend:chunks ✅ pass 0.3s
backend:build ✅ pass 4.9s
cli:build ✅ pass 2.1s
verify:entropy ✅ pass 16.3s

Verification: verify:integration

Result: ✅ PASS

@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

hackerwins added a commit that referenced this pull request May 31, 2026
PRs #257/#301/#303/#304/#305/#306/#307/#309/#315/#316/#317/#321/#322
shipped between v0.4.2 and the v0.4.3 cut, leaving their paired todo
files in active with the process checkboxes still open. Flip the
remaining boxes for the work that landed, then move the paired
todo/lessons into docs/tasks/archive/2026/05/ via pnpm tasks:archive.
Active count drops from 17 to 6; archive count grows by 21 files.

Patch release covering 29 commits since v0.4.2. Headline theme is
Slides editing & UX polish toward Google Slides / PowerPoint parity:
smart guides (equal-spacing / distance / size), Shift drag modifiers,
text inside shapes, a Format options right panel, tier-1 universal
toolbar controls, text autofit (shrink + grow), group-selection
visuals, and several smaller text-box / selection fixes. PPTX import
gained paragraph-level bullet styles, body anchor (vertical
alignment), and stretched blipFill cover-crop.

Docs added a pending-inline-style at collapsed caret, a caret that
tracks the resolved text color, bullet indent on Tab / Shift+Tab,
font / size / line-spacing / clear formatting toolbar controls, an
inline-style-attribute clear that actually lands in the CRDT, and a
polished toolbar trigger / color swatch pass shared across docs /
sheets / slides. Sheets gained .xlsx import.

Infrastructure: Docker images now build on native arm64 runners,
fixing the release hang seen on v0.4.2. No Prisma migration, no new
backend env vars — the devops bump is a routine image-tag change.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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