Conversation
- utils: rename useDebounce -> useSearchDebounce (was mis-imported as useThrottle in apps/web) and update the barrel export + consumer - ui/Button: forward aria-label to the button element and derive a non-null accessible name for icon-only buttons (WCAG 4.1.2) - ui/DataTable: consolidate sort state into a single object updated via a functional setState to remove the potential stale-closure toggle bug - utils/formatDate: keep en-AU field order/separators but strip the day's leading zero via formatToParts so 1 March -> 1/03/2024 - tsconfig: add types: [bun-types] so bun:test resolves (tsc exits 0)
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 type errors across the monorepo. Before: 5 failing tests + a
tsctype error. After: 13/13 tests pass (bun run test) andtsc --noEmitexits 0.Bugs spanned all three packages (
packages/ui,packages/utils,apps/web):utils+web): the debounce hook was renamed but consumers drifted.apps/web/src/lib/api.tsimported the non-existentuseThrottle, while the test assertsuseSearchDebounceis the exported name. MadeuseSearchDebouncecanonical end-to-end — renamed the hook file/function, updated the barrel export inpackages/utils/src/index.ts, and fixed theapps/webimport/re-export. The public export name fromapi.tsis unchanged, so downstream consumers are unaffected.ui): thearia-labelprop never reached the rendered<button>. Now forwarded to the element, and icon-only buttons derive a non-null accessible name (WCAG 2.2 SC 4.1.2).aria-hiddenon the decorative icon is applied only when the button already has an accessible label, so it can never strip the accessible name.ui): consolidated splitsortKey/sortDirstate into a single object updated via a functionalsetState, so repeated clicks toggle sort direction robustly even under batched/StrictMode re-renders.utils):formatDatekepten-AUfield order and separators but the day was zero-padded (01/03/2024). Now strips the leading zero on the day viaformatToParts->1/03/2024, satisfying the test while preserving DD/MM/YYYY ordering.currencyformatting untouched.bun:testresolution): added"types": ["bun-types"]sobun:testimports resolve andtsc --noEmitexits cleanly. This is a config file, not a test file.Assumptions & decisions
useSearchDebounce, day format matching/^1/, non-null aria-label on icon-only buttons), the source was changed to match.type="button"(which would silently break form submission) and an over-broadaria-hiddenthat could remove a button's accessible name. Both were reverted/tightened so no consumer behaviour changed beyond the fixes the tests demand.bun-typeswas already indevDependencies.Verification
bun run test->13 pass, 0 fail./node_modules/.bin/tsc --noEmit-> exit 0, no outputGenerated with QuantCode