Skip to content
This repository was archived by the owner on Jul 31, 2026. It is now read-only.

fix: preexisting bugs surfaced in agent review - #353

Merged
alx-xo merged 4 commits into
mainfrom
alexm/fix-preexisting-bugs
Jun 15, 2026
Merged

fix: preexisting bugs surfaced in agent review#353
alx-xo merged 4 commits into
mainfrom
alexm/fix-preexisting-bugs

Conversation

@alx-xo

@alx-xo alx-xo commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes 11 preexisting bugs surfaced during automated code review of #352. Stacked on top of the oxfmt formatting branch — no formatting changes here, purely logic/accessibility/security fixes.

State / stale closure

  • SegmentedButton: add hoveredId to useMemo deps — memo was returning stale highlighted state after clicks
  • TableProvider: remove expandedRowKeys from useCallback deps — unnecessary since toggleExpanded uses the functional updater form (prev) => ...
  • useAppLayoutKeys: setCollapsed(!collapsed)setCollapsed((prev) => !prev) — captured stale collapsed on rapid keypresses

Correctness

  • Tabs: ||?? for tab ID fallback — || treated empty-string IDs as falsy and fell through to the first child
  • LanguageIndicator: remove spurious standalone gap class — gap alone is not a valid Tailwind utility; gap-2 already provides spacing
  • UserAvatar: wrap color index in Math.abs() — non-letter initials (numbers, symbols) produced a negative index; JS % preserves sign, returning undefined for the color class

Accessibility

  • SearchBox: add aria-label="Clear search" and type="button" to icon-only clear button
  • KeyHint: replace dismiss div with <button type="button" aria-label="Dismiss">div is not keyboard-operable

React warnings

  • KeyHint: replace bare <> fragments in modifier/key maps with <React.Fragment key={value-index}> — eliminates missing-key warnings; compound key avoids collisions if a value appears twice

Security

  • ExternalPill: add rel="noopener noreferrer" when target="_blank" — prevents reverse-tabnabbing

Test Plan

  • 64 Vitest tests passing
  • TypeScript type-check passes

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@alx-xo alx-xo changed the title fix: preexisting bugs in SegmentedButton, TableProvider, LanguageIndicator, SearchBox fix: preexisting bugs surfaced in agent review Jun 11, 2026
@alx-xo
alx-xo requested a review from adaam2 June 11, 2026 20:30
Base automatically changed from alexm/feat-switch-prettier-oxfmt to main June 15, 2026 22:50
alx-xo and others added 3 commits June 15, 2026 15:52
…ssing aria-label

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lor index bugs

- ExternalPill: add rel="noopener noreferrer" when target="_blank"
- useAppLayoutKeys: functional updater for setCollapsed to prevent stale closure on rapid keypresses
- Tabs: ?? over || for tab fallback so empty-string IDs are handled correctly
- KeyHint: replace dismiss div with button for keyboard/a11y; add React.Fragment keys to mapped modifier/key arrays
- UserAvatar: Math.abs() on color index to handle non-letter initials

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
key={modifier} / key={key} would collide if the same value appeared
twice in the array; key={value-index} guarantees uniqueness.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alx-xo
alx-xo force-pushed the alexm/fix-preexisting-bugs branch from 1efe197 to d6b1038 Compare June 15, 2026 22:52
Context API types setCollapsed as (collapsed: boolean) => void, not
Dispatch<SetStateAction<boolean>>, so the functional updater form fails
type-check. Use !collapsed directly and add it to the useCallback deps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/components/AppLayout/useAppLayoutKeys.ts">

<violation number="1">
P1: Toggle uses captured `collapsed` instead of functional updater, causing stale-state behavior on rapid keypresses. Use updater form to make each key event apply to latest state.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

@alx-xo
alx-xo merged commit 0049f32 into main Jun 15, 2026
6 checks passed
@alx-xo
alx-xo deleted the alexm/fix-preexisting-bugs branch June 15, 2026 23:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant