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
7 changes: 2 additions & 5 deletions apps/web/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 }
3 changes: 2 additions & 1 deletion bunfig.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[test]
environment = "happy-dom"
environment = "happy-dom"
preload = ["./packages/ui/test/setup.ts"]
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={iconOnly ? (ariaLabel ?? "") : ariaLabel}
>
{icon && <span className="btn-icon">{icon}</span>}
{!iconOnly && children}
Expand Down
3 changes: 1 addition & 2 deletions packages/ui/src/components/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ export function DataTable<T extends Record<string, unknown>>({ data, columns }:
const [sortKey, setSortKey] = useState<keyof T | null>(null)
const [sortDir, setSortDir] = useState<SortDir>("asc")

// 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
5 changes: 1 addition & 4 deletions packages/utils/src/format/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
* and rely on the locale to order them correctly.
*/
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