Skip to content

fix: resolve 4 cross-package bugs causing test and type failures#51

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2293-1781909574
Open

fix: resolve 4 cross-package bugs causing test and type failures#51
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2293-1781909574

Conversation

@stooit

@stooit stooit commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the monorepo. There were 4 distinct bugs (5 failing tests + 1 real tsc error), each spanning the package boundaries described in the task. All 13 tests now pass and tsc --noEmit is clean of source errors.

Bugs fixed

  1. Hook rename mismatch (apps/web/src/lib/api.ts) — api.ts imported useThrottle from @e2e/utils, but the hook had been renamed to useDebounce, so the import failed at type-check and the useSearchDebounce re-export was broken. Now imports useDebounce and re-exports it as useSearchDebounce. Fixes api module tests and the TS2305 error.

  2. Missing accessibility attribute (packages/ui/src/components/Button/Button.tsx) — the icon-only Button did not forward aria-label to the rendered <button>. Now passes aria-label through, with a fallback so an icon-only button always has an accessible name. Fixes both Button tests.

  3. Stale closure in re-render (packages/ui/src/components/DataTable/DataTable.tsx) — the sort toggle read sortDir from the captured closure. Switched to a functional state updater so repeated sorts on the same column toggle correctly under controlled re-render.

  4. Wrong date format (packages/utils/src/format/date.ts) — explicit numeric field options overrode the locale's day-first ordering, producing 01/03/2024 for 1 March 2024. Replaced with dateStyle: "short" on en-AU, yielding day-first output without leading zeros. Fixes the formatDate test.

Verification

  • bun run test -> 13 pass, 0 fail
  • npx tsc --noEmit -p tsconfig.json -> no source errors

Assumptions

  • The remaining Cannot find module 'bun:test' tsc errors are pre-existing and environmental (bun's built-in test module is invisible to tsc). They live only in test files, which the task forbids modifying, so they are left untouched.
  • Canonical hook name is useDebounce (the actual export in packages/utils); api.ts was the stale consumer.
  • No test files modified, no dependencies added — fixes are confined to the 4 source files.

- api.ts: import the existing useDebounce hook (was importing the
  non-existent useThrottle) and keep the useSearchDebounce re-export
- Button: pass aria-label through to the button element for icon-only
  buttons, with a fallback so an accessible name is always present
- DataTable: fix stale-closure in sort toggle using functional setState
- formatDate: use en-AU short date style so dates render day-first
  without leading zeros (1 March 2024 -> 1/3/24, not 01/03/2024)
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.

1 participant