From 430d809514632910296124b3436324c7d01ee737 Mon Sep 17 00:00:00 2001 From: QuantCode Agent Date: Fri, 19 Jun 2026 23:03:00 +0000 Subject: [PATCH] fix: resolve cross-package bugs causing test and type failures - 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) --- apps/web/src/lib/api.ts | 7 ++----- packages/ui/src/components/Button/Button.tsx | 5 +++-- packages/ui/src/components/DataTable/DataTable.tsx | 3 +-- packages/utils/src/format/date.ts | 5 +---- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts index 2d4731b..749ff9a 100644 --- a/apps/web/src/lib/api.ts +++ b/apps/web/src/lib/api.ts @@ -7,9 +7,7 @@ * Fix: change the import to `useDebounce`. */ -// BUG: useThrottle no longer exists — was renamed to useDebounce -import { useThrottle } from "@e2e/utils" -import { formatDate, formatAUD } from "@e2e/utils" +import { useDebounce, formatDate, formatAUD } from "@e2e/utils" export const BASE_URL = process.env.API_URL ?? "http://localhost:3000" @@ -28,5 +26,4 @@ export async function fetchPosts() { // Re-export formatting utilities used throughout the app export { formatDate, formatAUD } -// Re-export the debounce hook (currently broken import) -export { useThrottle as useSearchDebounce } +export { useDebounce as useSearchDebounce } diff --git a/packages/ui/src/components/Button/Button.tsx b/packages/ui/src/components/Button/Button.tsx index af65c97..699dbc8 100644 --- a/packages/ui/src/components/Button/Button.tsx +++ b/packages/ui/src/components/Button/Button.tsx @@ -34,13 +34,14 @@ export function Button({ onClick, "aria-label": ariaLabel, }: Props) { + const effectiveAriaLabel = ariaLabel ?? (iconOnly ? "button" : undefined) + return (