Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// BUG: useThrottle no longer exists — was renamed to useDebounce
import { useThrottle } from "@e2e/utils"
import { useSearchDebounce } from "@e2e/utils"
import { formatDate, formatAUD } from "@e2e/utils"

export const BASE_URL = process.env.API_URL ?? "http://localhost:3000"
Expand All @@ -29,4 +29,4 @@ export async function fetchPosts() {
export { formatDate, formatAUD }

// Re-export the debounce hook (currently broken import)
export { useThrottle as useSearchDebounce }
export { useSearchDebounce }
1 change: 1 addition & 0 deletions packages/ui/bunfig.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[test]
environment = "happy-dom"
preload = ["./test/setup.ts"]
3 changes: 1 addition & 2 deletions packages/ui/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ export function Button({
className={`btn btn-${variant}`}
disabled={disabled}
onClick={onClick}
// BUG: aria-label is not applied when iconOnly is true and no ariaLabel is passed
// The component should enforce aria-label for icon-only buttons
aria-label={ariaLabel ?? (iconOnly ? "" : undefined)}
>
{icon && <span className="btn-icon">{icon}</span>}
{!iconOnly && children}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function DataTable<T extends Record<string, unknown>>({ data, columns }:
// BUG: stale closure — sortDir is captured at handler creation time
const handleSort = (key: keyof T) => {
if (sortKey === key) {
setSortDir(sortDir === "asc" ? "desc" : "asc") // BUG: reads stale sortDir
setSortDir((prev) => (prev === "asc" ? "desc" : "asc"))
} else {
setSortKey(key)
setSortDir("asc")
Expand Down
4 changes: 1 addition & 3 deletions packages/utils/src/format/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
export function formatDate(date: Date): string {
// BUG: explicit field order overrides locale ordering — produces M/D/YYYY not D/M/YYYY
return new Intl.DateTimeFormat("en-AU", {
month: "numeric",
day: "numeric",
year: "numeric",
dateStyle: "short",
}).format(date)
}

Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { useDebounce } from "./hooks/useDebounce"
export { useDebounce as useSearchDebounce } from "./hooks/useDebounce"
export { usePagination } from "./hooks/usePagination"
export { formatAUD } from "./format/currency"
export { formatDate, formatDateTime } from "./format/date"
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"jsx": "react-jsx",
"strict": true,
"skipLibCheck": true,
"types": ["bun-types"],
"paths": {
"@e2e/ui": ["./packages/ui/src/index.ts"],
"@e2e/utils": ["./packages/utils/src/index.ts"]
Expand Down