fix(endorsements): sidebar endorse updates counter and Received tab - #110
Conversation
The sidebar Endorse button only refetched the viewer's *given* endorsements, so the button flipped to "Endorsed" but the profile's "Endorsed by N" counter and the Endorsements tab Received list (both backed by the 5-min received-endorsements scan cache) lagged until the indexer caught up. Add a shared optimistic overlay to useReceivedEndorsements (module store + useSyncExternalStore, mirroring endorsement-closure-cache) and have the sidebar button push add/remove into it on write success, so every consumer of the subject's received list reflects the change immediately. Removes the now-redundant tab-local overlay and the dead EndorseShortcut (never rendered since the toggle moved to the sidebar). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Resolves PR #110 conflicts against the merged overnight-review work (PR #111). PR #110 and overnight-review's quality-005 independently removed the same dead received-overlay + EndorseShortcut; the conflicts were reconciled to keep BOTH intents: - profile-endorsements.tsx: kept the base (extracted PersonCard via quality-012, useClickOutsideClose, stable comparators); PR #110's overlay removal was already satisfied. Re-added PR #110's accurate 'overlay now lives in the hook' comment. - use-received-endorsements.ts: auto-merged — PR #110's shared optimistic overlay (module store + useSyncExternalStore) AND quality-032's focus-revalidation AbortController both retained. - profile-sidebar.tsx + endorse-reason-confirm.ts: kept quality-048's testable orchestrator and threaded PR #110's optimistic push through a new optional onAwardCreated callback (fires the instant the award lands), so the sidebar still updates the counter + Received tab immediately. Added two unit tests for the new callback path. Gate: vitest 476 passing, tsc 0 errors, lint 0 errors / 67 warnings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
Summary
useReceivedEndorsements(module store +useSyncExternalStore, mirroringendorsement-closure-cache) and wired the sidebar button to push add/remove into it on write success, so every consumer of the subject's received list reflects the change immediately.EndorseShortcut(never rendered since the toggle moved to the sidebar).Test plan
npx tsc --noEmitclean;npm run lintshows no new warnings.🤖 Generated with Claude Code