fix: repair cross-package bugs so bun test and tsc pass - #111
Open
stooit wants to merge 1 commit into
Open
Conversation
Fixes four cross-package defects plus the tooling config that hid them: - utils: consumers imported the old hook name useThrottle; the hook was renamed to useDebounce. Update apps/web api.ts import and the useSearchDebounce re-export alias. - ui/Button: aria-label was destructured but never applied to <button>. Pass it through with a children-derived fallback for icon-only buttons and a dev-time warning when an icon-only button has no label. - ui/DataTable: sort-direction toggle read captured state; switch to a functional updater to avoid the stale-closure bug. - utils/date: en-AU numeric format emitted a leading zero on the day; assemble via formatToParts so day has no leading zero (1/03/2024). - config: root bunfig.toml used the non-Bun `environment` key (silently ignored, so document was undefined); preload the happy-dom setup file instead. Add bun-types to tsconfig so `bun:test` resolves. No test files or dependencies changed.
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
Makes
bun test && tsc --noEmitfully pass from the repo root (was 9 fail / 4 pass + 5 type errors → now 13 pass / 0 fail,tscexit 0). Fixes four cross-package defects plus the test-runner config that was masking all of the UI failures.Root causes & fixes
apps/web/src/lib/api.tsuseThrottle, but the utils hook was renamed touseDebounce(broke the import andtsc)useDebounce; keep the publicuseSearchDebouncealias unchangedpackages/ui/src/components/Button/Button.tsxaria-labeldestructured but never applied to<button>children-derived fallback for icon-only buttons + dev-time warning when an icon-only button has no labelpackages/ui/src/components/DataTable/DataTable.tsxsortDir(stale closure)setSortDir((prev) => …)packages/utils/src/format/date.ts01/03/2024)formatToPartsso the day has no leading zero (1/03/2024)bunfig.toml(root)environment = "happy-dom"key — silently ignored, sodocumentwas undefined and every UI test erroredpreload = ["./packages/ui/test/setup.ts"]so barebun testworkstsconfig.jsonbun:testunresolved"types": ["bun-types"](already installed)All six UI test failures shared a single root cause (no DOM from #5); once fixed, the functional-updater change (#3) is defensive hardening of the flagged stale-closure area.
Verification
Constraints honoured
bun-typeswas already a devDependency).packages/ui/bunfig.tomlleft unchanged so per-package runs keep working.Follow-ups (out of scope, non-blocking)
"Button"conveys nothing to a screen reader; a requiredaria-labelwheniconOnly(discriminated union) would enforce it at compile time.onClickon a bare<th>with notabIndex/onKeyDown(WCAG 2.2 SC 2.1.1) — pre-existing.🤖 Generated with QuantCode