Click peer avatar to scroll to that collaborator's caret in docs#188
Conversation
Design for clicking a collaborator's avatar in the docs SiteHeader to smooth-scroll the editor so the peer's caret is visible. Mirrors the Sheets click-to-jump UX but only scrolls — the local caret stays put, which avoids interrupting typing flow in the docs editor. The change also generalises the shared UserPresence component so it no longer carries Sheets-specific prop names. Sheets call sites get a pure refactor with no behavioural change. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Bite-sized task breakdown for the spec at docs/design/docs/docs-peer-jump.md: five tasks covering the new EditorAPI.scrollToPosition method, UserPresence generalisation + Sheets migration, DocsView jump handle, DocsLayout wiring, and manual verification + archive. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Domain-agnostic helper that smooth-scrolls the viewport so a given DocPosition appears roughly one-third from the top. Reuses the existing resolvePositionPixel helper that backs peer cursor rendering and Cmd+F result jumps. Silent no-op before the first paint or when the blockId is stale. Caches canvasHeight and logicalCanvasWidth in initialize() closure scope so the new method can read them outside the render pipeline.
UserPresence no longer knows about Sheets-specific activeCell. The component now emits a domain-agnostic onSelectPeer(clientID) event and asks the host for a tooltip hint via getJumpHint(clientID). This is the precondition for wiring docs peer-jump in a follow-up commit. Sheets call sites in document-detail.tsx and shared-document.tsx are migrated to the new API. Each picks up the click, looks up the peer in Yorkie presence, and runs the same tab-resolution + peer-jump- target logic as before. Pure refactor — no behavioural change.
Pull the duplicated hint/canJump computation out of renderAvatar and the +N dropdown into a tiny resolveHint helper so the pattern lives in one place. Replace onSelectPeer!() non-null assertions with an explicit early return that lets TypeScript narrow the prop. Pure refactor — no behavioural change.
DocsView gains a jumpToPeer(clientID) callback that resolves the peer's activeCursorPos from Yorkie presence and asks the editor to scrollToPosition there. Also resets the 4-second peer-label timer so the username briefly re-appears at the landing position. The handle is published via a new optional onJumpHandleReady prop; no consumer wires it up in this commit.
The prop comment claimed 'peer-jump, scroll' but the JumpHandle exposes only jumpToPeer. Drop the misleading 'scroll' clause.
DocsLayout now holds a JumpHandle from DocsView and forwards peer avatar clicks through it. getJumpHint reads the peer's username from DocsPresence and gates the click affordance on activeCursorPos being present. Only the viewport scrolls — the local caret is unaffected.
Manual verification deferred to PR review (recorded in the lessons file). All five plan tasks shipped behind pnpm verify:fast green across each commit.
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Verification: verify:selfResult: ✅ PASS in 143.8s
Verification: verify:integrationResult: ✅ PASS |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Adds @wafflebase/slides as a third surface alongside Sheets and Docs, plus 53-shape library (Phase 1+2), adjustment handles for 9 pilot shapes (P3-A.1), live snap guides, align/distribute toolbar, themed authoring, and layout-change UI. Also ships Sheets cell comments (Phase B), docs peer-avatar caret jump, yorkie-js-sdk 0.7.8 upgrade, and CLI/REST API improvements (docs export imageFetcher, expired session refresh, REST docs split). Minor bump because slides is a new top-level package. Highlights: #184 #185 #186 #187 #188 #189 #190 #191 #192 #197 #198 #201 #202 #203 #204 #205 #206 #207 #209 #210
Summary
UserPresencecomponent (used by Sheets too) to a domain-agnosticonSelectPeer(clientID)+getJumpHint(clientID)API. Sheets call sites are migrated as a pure refactor — no behavioural change.EditorAPI.scrollToPosition(pos: DocPosition)to@wafflebase/docsthat reuses the existingresolvePositionPixelhelper.Design:
docs/design/docs/docs-peer-jump.mdImplementation plan / lessons: archived under
docs/tasks/archive/2026/05/.Test plan
pnpm verify:fast(lint + typecheck + 741 unit tests) is green on every commit.Two-browser smoke checklist (open the same docs document in two windows signed in as different users):
Click to jump to {username}.activeCursorPosyet (tooltip shows only username).Notes
SharedDocsLayout(read-only shared docs view) still passes a bare<UserPresence />and is not wired for peer-jump in this PR — flagged as a follow-up in the lessons file.🤖 Generated with Claude Code