WIP 2.0.0: React Compiler lint rules back to errors; docs

- The 192 places the rules flagged are fixed and the rules are errors
  again (npx eslint src: nothing). lib/hooks.ts: useStateSync (state
  that follows other state, set while rendering), useExternalEffect
  (API loads and browser reads), useNow; lib/navigation.ts hardNavigate
  for full reloads after sign-out or identity switches; other pages use
  the router. Resets moved into the handlers that cause them.
- The banner shows and hides at its times on open pages.
- HANDOVER, roadmap, README, FEATURES, SETTINGS, CHANGELOG updated;
  2.0.0 section drafted in WHATS-NEW.

e2e 102/102 (PayFast sandbox skipped); production build passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 17:45:25 +02:00
co-authored by Claude Opus 5.5
parent 9913a13f70
commit 8cc2cefe80
102 changed files with 613 additions and 354 deletions
+10 -4
View File
@@ -2,6 +2,7 @@
import React, { useEffect, useId, useMemo, useRef, useState } from "react";
import { ChevronDown, Search, X } from "lucide-react";
import { useStateSync, useNow } from "@/lib/hooks";
export type PickerEvent = {
id: string;
@@ -52,15 +53,16 @@ export function EventPicker<E extends PickerEvent>({ events, value, onChange, em
const listRef = useRef<HTMLUListElement>(null);
const selected = events.find(e => e.id === value) || null;
const now = useNow();
const { upcoming, past } = useMemo(() => {
const cutoff = Date.now() - graceHours * 3600e3;
const cutoff = now - graceHours * 3600e3;
const up: E[] = [];
const old: E[] = [];
for (const ev of events) (isPast(ev, cutoff) ? old : up).push(ev);
up.sort((a, b) => +new Date(a.startDate) - +new Date(b.startDate));
old.sort((a, b) => +new Date(b.startDate) - +new Date(a.startDate));
return { upcoming: up, past: old };
}, [events, graceHours]);
}, [events, graceHours, now]);
// What the list shows: [heading | event | "none"] rows. Only events and "none" are choosable.
const { rows, hidden } = useMemo(() => {
@@ -101,14 +103,18 @@ export function EventPicker<E extends PickerEvent>({ events, value, onChange, em
setShowPast(pastPick);
setOpen(true);
};
useEffect(() => {
// When it opens: the chosen event (or the first choice) is the active row, and the search
// box has focus.
useStateSync(() => {
if (!open) return;
inputRef.current?.focus();
const at = rows.findIndex(r => (r.kind === "event" ? r.ev.id === value : r.kind === "none" && !value));
setActive(at >= 0 ? at : (choosable[0] ?? 0));
// Only when it opens.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
useEffect(() => {
if (open) inputRef.current?.focus();
}, [open]);
useEffect(() => {
listRef.current?.querySelector(`[data-row="${active}"]`)?.scrollIntoView({ block: "nearest" });
}, [active, open]);