fix: repair cross-package bugs so all tests and types pass - #140
Open
stooit wants to merge 1 commit into
Open
Conversation
- utils: reconcile debounce hook export; api.ts imports useSearchDebounce/useDebounce instead of removed useThrottle - ui/Button: add aria-label with an audit-visible fallback for icon-only buttons - ui/DataTable: fix stale-closure sort bug via a single atomic SortState - ui: restore happy-dom environment for the ui package's bun tests (kept existing preload) - utils/date: use dateStyle short so day 1 is not zero-padded (locale/format fix) - tsconfig: add bun types so 'bun:test' resolves under tsc --noEmit
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.
bun test && tsc --noEmitnow reports 13 pass / 0 fail and tsc exit 0.Bugs spanned all three packages plus test/type configuration.
Changes
packages/utils+apps/web— a debounce hook was referenced under a stale name (useThrottle) that no longer existed. Reconciled the export in utils and updatedapps/web/src/lib/api.tsto import the canonicaluseDebounce/ exposeuseSearchDebounceas the tests expect.packages/ui/Button— icon-only buttons lacked an accessible name. Addedaria-labelwiring with a fallback of"Unlabelled button"(chosen over"Button"so the missing-label case stays visible to manual a11y audit / log review rather than being silently masked).packages/ui/DataTable— fixed a stale-closure bug in the sort handler (caught by the "sorts descending on second click" test) by moving sort key + direction into a single atomicSortState, avoiding nested/stale state updates under StrictMode.packages/ui/bunfig.toml+ rootbunfig.toml— the UI package's bunfig overrode the root config and droppedenvironment = "happy-dom", so UI tests ran without a DOM (document is not defined). Restored happy-dom for the UI tests while keeping the existing preload.packages/utils/date.ts—formatDatezero-padded day 1 (01/03/2024); switched todateStyle: "short"so 1 March 2024 renders starting with1, matching the test and consistent withformatDateTime.tsconfig.json— added bun types sobun:testresolves undertsc --noEmit(no test files modified).Constraints honoured
Notes / assumptions for reviewers
dateStyle: "short"was the option that satisfied/^1/while keeping the other date assertions green. Side effect: the year is now 2-digit. The test does not assert the year; flagged in case 4-digit years matter for your context.aria-labelvia a discriminated union wheniconOnly) was out of scope as it would breaktscon the unmodifiable test file.Verification