fix: repair four cross-package bugs surfaced by failing tests#49
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: import renamed hook useDebounce (was useThrottle) and
re-export as useSearchDebounce
- formatDate: use { dateStyle: "short" } so en-AU yields day-first dates
- Button: forward aria-label on icon-only buttons for an accessible name
- DataTable: use functional state updater in handleSort to fix stale closure
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 one product-code type error in the monorepo. Four distinct bugs spanning
packages/utils,packages/ui, andapps/web:apps/web/src/lib/api.ts— the hookuseThrottlewas renamed touseDebouncein@e2e/utils, butapi.tsstill imported the old name (the cause of theexport 'useSearchDebounce' not foundfailure and aTS2305error). Now importsuseDebounceand re-exports it under the public aliasuseSearchDebounce.packages/utils/src/format/date.ts—formatDateused explicit{ month, day, year: "numeric" }options producing month-first01/03/2024. Switched to{ dateStyle: "short" }with theen-AUlocale so dates are day-first (1/03/2024).packages/ui/src/components/Button/Button.tsx— the icon-only<button>branch did not forwardaria-label, so icon-only buttons had no accessible name. Now forwardsaria-label.packages/ui/src/components/DataTable/DataTable.tsx—handleSortread stalesortDirfrom the closure. Switched to the functional state updatersetSortDir(prev => ...).Verification
bun run test→ 13 pass, 0 fail.npx tsc --noEmit→ the one real product-code error (useThrottlenot exported) is gone. The remainingTS2307: Cannot find module 'bun:test'errors are pre-existing (present on the base commit7e2198e) and confined to test files; the task constraints forbid modifying test files, and they are unrelated to the four bugs.Notes / assumptions
dateStyle: "short"was chosen over hand-rolled options because it lets theen-AUlocale drive day-first ordering, matching the test's expectation.