fix: decouple release asset updated indicators from unread state - #283
Conversation
Per-asset 'assets updated' badges were cleared when a release was marked read (e.g. expanding it), hiding the very updates the user was meant to notice. Asset-level read state is now independent of release unread state: - Add markAssetAsRead store action that removes an asset id from a release's updated_asset_ids without touching readReleases/is_read - ReleaseCard badge no longer depends on isUnread; clicking an asset clears only that asset's badge - markAllReleasesAsRead also clears all per-asset badges and sets is_read=true on touched records so autoSync pushes cannot overwrite the backend's mark-all-read state with stale is_read:false - Add ReleaseCard component tests and extend store tests
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change replaces timestamp-based asset indicators with explicit ChangesAsset update indicator contract
Store asset read state
Release view asset interactions
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to This change separates asset-update indicators from release read state and adds targeted handling for marking assets and releases read. No actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant User
participant ReleaseCard
participant ReleaseTimeline
participant useAppStore
User->>ReleaseCard: Click an asset link or RPC download
ReleaseCard->>useAppStore: markAssetAsRead(assetId)
useAppStore->>useAppStore: Remove assetId from updated_asset_ids
ReleaseTimeline->>ReleaseCard: Provide markAssetAsRead callback
useAppStore->>ReleaseCard: Updated release state
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
The container-level "Assets updated" badge was inferred from asset updated_at > release published_at, which is true for nearly every GitHub release (assets are uploaded after release creation) and unrelated to changes since the user's last pull — causing massive false positives with no matching per-asset badge. Make updated_asset_ids the single source of truth for both the container and per-asset indicators, and clear it in markReleaseAsRead so clicking a release dismisses its badges. The repository group header now shows the badge when any release in the group has undismissed asset updates. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Fixes the issue where per-asset "资产已更新 / Assets updated" badges disappeared as soon as a release was marked read (e.g. when expanding its assets), hiding the very updates the user was meant to notice.
Asset-level read state is now independent of release-level unread state:
markAssetAsRead(assetId): removes an asset id from a release'supdated_asset_idswithout touchingreadReleases/is_read; early-returns when no release contains the asset to avoid redundant re-renders and autoSync pushes.isUnread— it only reflectsupdated_asset_ids. Clicking an asset (RPC button or plain link) clears only that asset's badge; it no longer propagates to the release-level mark-as-read.onMarkAssetAsReadthrough both<ReleaseCard>usages.is_read: trueon touched records so a later autoSync full push cannot overwrite the backend's mark-all-read state with staleis_read: false.Changes
src/store/useAppStore.ts: addmarkAssetAsRead, updatemarkAllReleasesAsReadsrc/components/ReleaseCard.tsx: decouple badge fromisUnread, addonMarkAssetAsReadpropsrc/components/ReleaseTimeline.tsx: passonMarkAssetAsReadsrc/store/useAppStore.test.ts: extend store action testssrc/components/ReleaseCard.test.tsx: new component regression testsTesting
githubListsApi.ts/autoSync.githubToken.test.ts)Summary by CodeRabbit
New Features
Tests