fix: resolve 4 cross-package bugs causing test and type failures#51
Open
stooit wants to merge 1 commit into
Open
fix: resolve 4 cross-package bugs causing test and type failures#51stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- 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)
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 in the monorepo. There were 4 distinct bugs (5 failing tests + 1 real
tscerror), each spanning the package boundaries described in the task. All 13 tests now pass andtsc --noEmitis clean of source errors.Bugs fixed
Hook rename mismatch (
apps/web/src/lib/api.ts) —api.tsimporteduseThrottlefrom@e2e/utils, but the hook had been renamed touseDebounce, so the import failed at type-check and theuseSearchDebouncere-export was broken. Now importsuseDebounceand re-exports it asuseSearchDebounce. Fixesapi moduletests and theTS2305error.Missing accessibility attribute (
packages/ui/src/components/Button/Button.tsx) — the icon-onlyButtondid not forwardaria-labelto the rendered<button>. Now passesaria-labelthrough, with a fallback so an icon-only button always has an accessible name. Fixes bothButtontests.Stale closure in re-render (
packages/ui/src/components/DataTable/DataTable.tsx) — the sort toggle readsortDirfrom the captured closure. Switched to a functional state updater so repeated sorts on the same column toggle correctly under controlled re-render.Wrong date format (
packages/utils/src/format/date.ts) — explicit numeric field options overrode the locale's day-first ordering, producing01/03/2024for 1 March 2024. Replaced withdateStyle: "short"onen-AU, yielding day-first output without leading zeros. Fixes theformatDatetest.Verification
bun run test-> 13 pass, 0 failnpx tsc --noEmit -p tsconfig.json-> no source errorsAssumptions
Cannot find module 'bun:test'tscerrors are pre-existing and environmental (bun's built-in test module is invisible totsc). They live only in test files, which the task forbids modifying, so they are left untouched.useDebounce(the actual export inpackages/utils);api.tswas the stale consumer.