Conversation
- api.ts: import useDebounce (renamed from useThrottle), re-export as useSearchDebounce - Button: apply aria-label for icon-only buttons (WCAG 4.1.2) - formatDate: day-first, unpadded day for en-AU output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and the target type error in the monorepo. 13/13 tests pass and the
useThrottletsc error is eliminated. Three cross-package bugs fixed with minimal, targeted changes — no test files modified, no dependencies added.Root causes & fixes
Renamed hook import (
apps/web/src/lib/api.ts)packages/utilsrenamed its hook touseDebounce, butapi.tsstill imported the olduseThrottle(tscTS2305). Updated the import touseDebounceand re-exported it under the app-facing nameuseSearchDebouncethatapps/web/test/api.test.tsexpects.Icon-only button accessibility (
packages/ui/src/components/Button/Button.tsx) — WCAG 4.1.2The
aria-labelprop was destructured but never applied to the rendered<button>, so icon-only buttons had no accessible name. It's now forwarded; icon-only buttons with no explicit label fall back to their string children (or a placeholder) and emit a dev-modeconsole.warnso a missing label surfaces in CI rather than shipping silently. Non-icon-only buttons are unaffected.Date format (
packages/utils/src/format/date.ts)formatDatefor "1 March 2024" returned01/03/2024but the test requires day-first with an unpadded day (1/03/2024). ICU pads the day foren-AUeven withday: "numeric", so the fix usesformatToPartsand strips the day's leading zero while keeping locale field ordering.formatDateTimeand the currency utilities are untouched.Verification
bun run test-> 13 pass, 0 fail (5 files)bunx tsc --noEmit-> theuseThrottleerror is gone. The 4 remainingCannot find module 'bun:test'errors are pre-existing (present on the base commit), live only in test files (which must not be modified), and are unrelated to these changes.Notes / assumptions
bun run test(the rootpackage.jsonscript), which supplies the happy-dom--preloadthe React DOM tests need; barebun testfrom root lacks it.aria-labelfallback is partly shaped by an existing test asserting the attribute is non-null even when no label is passed; a reviewer flagged this as a recorded trade-off rather than a defect. Left as-is to honour the "fix only what tests require" constraint.🤖 Generated with QuantCode