Redraw a base's marks when Obsidian re-renders its entries #253

Merged
cruelacid merged 1 commit from worktree-bases-dot-recycle into main 2026-10-02 12:40:31 +01:00
Owner

Task: NEC-199

Follow-up to #252, found by the user while testing in their own vaults. While scrolling a cards view, the shared-entry dot showed on cards that were not shared, then cleared up to 2 s later. The cause: on scroll Obsidian reuses card elements to show other notes, and the plugin redrew a frame after the scroll. The cards view also re-renders from an IntersectionObserver, whose callbacks run after that frame, so the redraw could come first and the dot stayed on a reused card until the 2 s tick. A collaborator's focus outline had the same race.

Each open base is now watched with a MutationObserver (childList only, so the marks it draws cannot trigger it) and redraws as soon as Obsidian finishes a re-render.

Verification

  • New e2e: scrolls a 60-card view of interleaved shared and unshared notes and checks every dot 300 ms after each scroll. It fails with the redraw disabled (7 wrong cards at 25%) and passes with it.
  • New unit test for a recycled card. Disabling the redraw fails it; so does never stopping the watch when a base closes.
  • pnpm test, pnpm -r typecheck, pnpm lint, build-mirror --check and the full container e2e (160 passed, 2 skipped) all pass.
  • The user confirmed the fix in their two vaults.

Changelog

In a base's cards and table views, the marks showing which entries are shared and where a collaborator is no longer linger on the wrong entry while you scroll.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AsUFqoi4GHKYjFtPbYCgRp

Task: NEC-199 Follow-up to #252, found by the user while testing in their own vaults. While scrolling a cards view, the shared-entry dot showed on cards that were not shared, then cleared up to 2 s later. The cause: on scroll Obsidian reuses card elements to show other notes, and the plugin redrew a frame after the scroll. The cards view also re-renders from an IntersectionObserver, whose callbacks run after that frame, so the redraw could come first and the dot stayed on a reused card until the 2 s tick. A collaborator's focus outline had the same race. Each open base is now watched with a MutationObserver (`childList` only, so the marks it draws cannot trigger it) and redraws as soon as Obsidian finishes a re-render. ## Verification - New e2e: scrolls a 60-card view of interleaved shared and unshared notes and checks every dot 300 ms after each scroll. It **fails with the redraw disabled** (7 wrong cards at 25%) and passes with it. - New unit test for a recycled card. Disabling the redraw fails it; so does never stopping the watch when a base closes. - `pnpm test`, `pnpm -r typecheck`, `pnpm lint`, `build-mirror --check` and the full container e2e (160 passed, 2 skipped) all pass. - The user confirmed the fix in their two vaults. ## Changelog In a base's cards and table views, the marks showing which entries are shared and where a collaborator is no longer linger on the wrong entry while you scroll. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01AsUFqoi4GHKYjFtPbYCgRp
Redraw a base's marks when Obsidian re-renders its entries
Some checks failed
Release note / release-note (pull_request) Successful in 15s
CI / build (pull_request) Successful in 5m6s
CI / e2e (pull_request) Successful in 8m31s
CI / promote (pull_request) Has been skipped
CI / build (push) Successful in 5m22s
CI / e2e (push) Failing after 7m38s
CI / promote (push) Has been skipped
938a4df33d
The shared-entry dot (and a collaborator's focus outline) was redrawn a frame
after a scroll. The cards view also re-renders from an IntersectionObserver,
whose callbacks run after the frame's, so a dot stayed on a recycled card now
showing an unshared note until the next 2 s tick took it off.

Each open base is now watched with a MutationObserver (childList only, so the
marks it draws cannot set it off), and redraws as soon as a re-render ends.
An e2e scrolls a 60-card view and checks the dots 300 ms after each scroll; it
fails with the redraw disabled.

Task: NEC-199

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AsUFqoi4GHKYjFtPbYCgRp
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Nectenda/nectenda!253
No description provided.