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
@@ -1,11 +1,12 @@
"use client";
import { useCallback, useEffect, useRef, useState } from "react";
import { useCallback, useRef, useState } from "react";
import { apiV2Data } from "@/lib/apiV2";
import {
OfflineLock, SnapshotTicket, clearOffline, deviceId, deviceName, findTicket, getOfflineLock,
queuedScans, recordScan, removeQueued, startOffline,
} from "@/lib/offlineScan";
import { useExternalEffect } from "@/lib/hooks";
export type OtherLock = { id: string; sectionId: string | null; sectionName: string | null; deviceId: string; deviceName: string | null; user: { name: string } };
@@ -26,7 +27,7 @@ export function useOfflineScanning(token: string | null) {
try { setPending((await queuedScans()).length); } catch { setPending(0); }
}, []);
useEffect(() => {
useExternalEffect(() => {
setLock(getOfflineLock());
refreshPending();
setOnline(typeof navigator === "undefined" ? true : navigator.onLine);
@@ -78,7 +79,7 @@ export function useOfflineScanning(token: string | null) {
}, [token, refreshPending]);
// Sync as soon as the connection is back, and every 30 seconds while online.
useEffect(() => {
useExternalEffect(() => {
if (!online || !token) return;
sync().catch(() => {});
const t = setInterval(() => { if (navigator.onLine) sync().catch(() => {}); }, 30000);