Clean up code found in the audit

- Replace every em-dash in src and server/src with a colon, comma or hyphen
- Give every relative import its file extension (.jsx imports of .tsx fixed)
- Delete old-historyMock.ts, unused exports, unused CSS utilities, the
  unused @ alias and the fallback option nothing passed
- One copy each of initials, capitalize, byName and the server's marks()
- Move the organization, chapter and event hooks from src/data to src/lib
- Schema sync always throws on a mismatch (strict was never turned off)
- Replace the placeholder README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:02:03 -05:00
parent 4066e9ec61
commit 5274e09571
75 changed files with 282 additions and 688 deletions

View file

@ -3,13 +3,7 @@
The read hook every page uses:
const { data, error, loading } = useResource("/events", {
fallback: { events: EVENTS }, // the old static module
});
Deliberately small. If the site ever needs mutation, refetch on
focus, or pagination, that's the point to reach for TanStack
Query rather than growing this file.
const { data, error, loading } = useResource("/events");
Note the `ignore` flag rather than an AbortController: the
request is shared and cached, so cancelling it would throw away
@ -20,22 +14,15 @@
import { useEffect, useState } from "react";
import { get } from "./api.ts";
export function useResource(path, { ttl, fallback }: { ttl?: number; fallback?: any } = {}) {
// Seed with the fallback so the first paint has content when one
// is available, rather than flashing a spinner and then the same
// data a moment later.
const [state, setState] = useState<any>(() => ({
data: fallback,
error: null,
loading: true,
}));
export function useResource(path, { ttl }: { ttl?: number } = {}) {
const [state, setState] = useState<any>({ data: undefined, error: null, loading: true });
useEffect(() => {
let ignore = false;
setState((prev) => ({ ...prev, loading: true, error: null }));
get(path, { ttl, fallback })
get(path, { ttl })
.then((data) => {
if (!ignore) setState({ data, error: null, loading: false });
})
@ -46,7 +33,7 @@ export function useResource(path, { ttl, fallback }: { ttl?: number; fallback?:
return () => {
ignore = true;
};
}, [path, ttl]); // fallback is intentionally not a dependency
}, [path, ttl]);
return state;
}