fix(notifications): handle a missing X-Total-Count and serialise unread fetches - #4
Conversation
…ad fetches Number(null) is 0, so an absent X-Total-Count header collapsed unreadTotal and readTotal to zero rather than falling back to the loaded count, hiding the unread count and the "Mark All as Read" button while rows were on screen. The 30s poll and a "Load More" click both wrote unreadNotifications and could overlap, letting whichever response landed last win: a poll issued before a "Load More" but resolving after it truncates the list back to the first page, dropping the page the user just asked for. Queue the unread fetches so each reads its offset only once the previous one has settled, and skip the poll while a "Load More" is pending so it cannot discard a loaded page. Addresses review feedback on maxdorninger#564. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SC2BDd7wA7hPa7k2h2yAv1
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
Follow-up to #2, which is already on
master. This carries only the review fixes from upstream maxdorninger/MediaManager#564 — one file, no re-application of the pagination work.Missing
X-Total-Countcollapsed the totals to zeroNumber(null)is0, notNaN, so theNumber.isNaNfallback intotalCountOfnever ran. If the header were absent,unreadTotal/readTotalwould be set to0while notifications were still rendered — hiding the unread count and the "Mark All as Read" button. It now falls back on a null or empty header and only accepts a finite number, so a genuine"0"still reads as zero.The 30s poll could race with "Load More"
Both write
unreadNotifications, and they could overlap: a poll issued before a "Load More" but resolving after it would overwrite the list with page one, discarding the page the user just asked for (or repeating an id in the keyed{#each}). Unread fetches now go through a promise queue, so each request reads its offset only once the previous one has settled — this covers the reverse direction too (a "Load More" clicked while a poll is in flight). The interval additionally skips whileloadingMoreUnreadis set, since a queuedresetwould otherwise truncate the list back to the first page right after a "Load More" resolved.Verification
null,"","0","12","abc":null/""now fall back instead of yielding0, and"0"still yields0.npm run lint(inweb/) — clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01SC2BDd7wA7hPa7k2h2yAv1