Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/ui/src/features/inbox/hooks/useInboxAllReports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export function useInboxAllReports(options?: {
status: INBOX_PIPELINE_STATUS_FILTER,
has_implementation_pr: true,
// Mirror the list query's active filters so the badge matches the tab
// body. These are empty when `ignoreFilters` is set (sidebar usage), so
// the count stays scope-only there.
// body. These are empty when `ignoreFilters` is set (e.g. the Runs tab),
// so the count stays scope-only there.
source_product:
sourceProductFilter.length > 0
? sourceProductFilter.join(",")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ export function SidebarNavSection({
const isMcpServersActive = view.type === "mcp-servers";

// Open pull requests in the inbox — the main CTA, and the same count the inbox
// Pull requests tab shows, so the badge and the tab always agree.
// `ignoreFilters` keeps the badge stable against the inbox's filter chrome;
// scope still follows the user's For-you / project choice.
const { counts: inboxCounts } = useInboxAllReports({ ignoreFilters: true });
// Pull requests tab shows, so the badge and the tab always agree. The badge
// tracks the inbox's active source/priority/search filters (and the user's
// For-you / project scope) so it never shows a total that contradicts the
// filtered list the user is looking at.
const { counts: inboxCounts } = useInboxAllReports();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Superfluous store subscriptions after removing ignoreFilters

Without ignoreFilters: true, the hook now subscribes to searchQuery, sortField, and sortDirection from the filter store, but neither of these affects counts.pulls (the only field the sidebar uses). pullRequestCountQuery — the source of counts.pulls — only uses source_product, priority, and suggested_reviewers. The result is that every search keystroke and every sort-order change re-renders SidebarNavSection and re-runs the scopedReports memo (including filterReportsBySearch), without the badge value ever changing. It won't cause a visible bug but is extra work on a component that's always mounted. Consider adding a pullRequestsOnly path (or a narrower ignoreSearchAndSort flag) to prevent these subscriptions for the sidebar context.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/features/sidebar/components/SidebarNavSection.tsx
Line: 89

Comment:
**Superfluous store subscriptions after removing `ignoreFilters`**

Without `ignoreFilters: true`, the hook now subscribes to `searchQuery`, `sortField`, and `sortDirection` from the filter store, but neither of these affects `counts.pulls` (the only field the sidebar uses). `pullRequestCountQuery` — the source of `counts.pulls` — only uses `source_product`, `priority`, and `suggested_reviewers`. The result is that every search keystroke and every sort-order change re-renders `SidebarNavSection` and re-runs the `scopedReports` memo (including `filterReportsBySearch`), without the badge value ever changing. It won't cause a visible bug but is extra work on a component that's always mounted. Consider adding a `pullRequestsOnly` path (or a narrower `ignoreSearchAndSort` flag) to prevent these subscriptions for the sidebar context.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread
Twixes marked this conversation as resolved.
const inboxPullRequestCount = inboxCounts.pulls;

// Only subscribe to the task list when a parent hasn't already supplied the
Expand Down
Loading