Skip to content

StatusBar: fix zero-severity noise, filter consistency, and avoid extra array allocation - #5

Merged
adamgell merged 3 commits into
claude/implement-todo-item-McwAVfrom
copilot/sub-pr-3
Mar 13, 2026
Merged

StatusBar: fix zero-severity noise, filter consistency, and avoid extra array allocation#5
adamgell merged 3 commits into
claude/implement-todo-item-McwAVfrom
copilot/sub-pr-3

Conversation

Copilot AI commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Three issues in the status bar's severity/position display, flagged in review:

  • Zero-count severities shownformatSeverityCounts unconditionally appended "0 info". All three severity parts now only emit when > 0.
  • Severity totals from unfiltered dataseverityCounts was computed from the raw entries array while entry count and position used the filtered set, creating an inconsistency (e.g. "0 entries | 3 errors"). Totals now reflect the active filter.
  • Unnecessary array allocationdisplayEntries materialized a full filtered copy of entries on every update just to get a count and an index. Replaced with a single-pass loop that computes filteredCount, severityCounts, and selectedPosition together, removing both the intermediate array and the now-redundant computeSeverityCounts helper.
// Before: three separate memos, one allocating a full filtered array
const severityCounts = useMemo(() => computeSeverityCounts(entries), [entries]);
const displayEntries = useMemo(() => filteredIds ? entries.filter(e => filteredIds.has(e.id)) : entries, [...]);
const selectedPosition = useMemo(() => displayEntries.findIndex(...), [displayEntries, selectedId]);

// After: one pass, severity from filtered set
const { filteredCount, severityCounts, selectedPosition } = useMemo(() => {
  let counter = 0, position = null, errors = 0, warnings = 0, info = 0;
  for (const entry of entries) {
    if (filteredIds && !filteredIds.has(entry.id)) continue;
    counter++;
    // accumulate severity + position
  }
  return { filteredCount: counter, severityCounts: { errors, warnings, info }, selectedPosition: position };
}, [entries, filteredIds, selectedId]);

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…es, single-pass memo

Co-authored-by: adamgell <27519+adamgell@users.noreply.github.com>
Copilot AI changed the title [WIP] Add entry count, position indicator, and severity totals to status bar StatusBar: fix zero-severity noise, filter consistency, and avoid extra array allocation Mar 13, 2026
Copilot AI requested a review from adamgell March 13, 2026 05:21
@adamgell
adamgell marked this pull request as ready for review March 13, 2026 12:03
Copilot AI review requested due to automatic review settings March 13, 2026 12:03

Copilot AI left a comment

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.

Pull request overview

This PR refines the log view status bar to make its “entries / position / severities” display consistent with the active filter while reducing work done per update.

Changes:

  • Suppresses zero-count severities in formatSeverityCounts (no more "0 info" noise).
  • Computes severity totals from the filtered set (matching the filtered entry count/position).
  • Replaces the filtered-array materialization with a single-pass aggregation over entries to derive filteredCount, severityCounts, and selectedPosition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/layout/StatusBar.tsx Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

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.

Pull request overview

Updates the log status bar to present cleaner severity information and keep counts consistent with the active filter, while reducing unnecessary allocations during rendering.

Changes:

  • Hide zero-count severities in formatSeverityCounts (no more “0 info” noise).
  • Compute severity totals from the filtered entry set to match the displayed entry count/position.
  • Remove the intermediate filtered array allocation by computing filteredCount and severity totals via iteration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +61 to +67
const { filteredCount, severityCounts } = useMemo(() => {
let errors = 0;
let warnings = 0;
let info = 0;
let counter = 0;

for (const entry of entries) {
@adamgell
adamgell merged commit b462eca into claude/implement-todo-item-McwAV Mar 13, 2026
4 checks passed
@adamgell
adamgell deleted the copilot/sub-pr-3 branch July 13, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants