chore: code quality audit and lint fixes
🔍 Lint / 🪄 Check lint (pull_request) Has been cancelled
🔍 Lint / 🎨 Check format (pull_request) Has been cancelled
🔍 Lint / 🔎 Typecheck (pull_request) Has been cancelled
📊 Quality / 🔒 Security Audit (pull_request) Has been cancelled
📊 Quality / 📋 Dependency Freshness (pull_request) Has been cancelled
📊 Quality / 📦 Bundle Size (pull_request) Has been cancelled
🔍 Lint / 🏗 Build (pull_request) Has been cancelled
🔍 Lint / 🪄 Check lint (pull_request) Has been cancelled
🔍 Lint / 🎨 Check format (pull_request) Has been cancelled
🔍 Lint / 🔎 Typecheck (pull_request) Has been cancelled
📊 Quality / 🔒 Security Audit (pull_request) Has been cancelled
📊 Quality / 📋 Dependency Freshness (pull_request) Has been cancelled
📊 Quality / 📦 Bundle Size (pull_request) Has been cancelled
🔍 Lint / 🏗 Build (pull_request) Has been cancelled
- Fix all 63 ESLint errors across codebase - Consolidate MaterialWithTextureSlots type in src/types/three/three.ts - Add CSS custom properties for design tokens - Extract ebike constants to src/data/ebike/ebikeConfig.ts - Add proper TypeScript types for window extensions - Fix React hooks violations (refs during render, setState in effects) - Remove unused exports and redundant CSS - Add type guards for Three.js material handling - Clean up AI slop comments and legacy CSS patterns
This commit is contained in:
@@ -102,6 +102,8 @@ export function TestMap({ onOctreeReady }: TestMapProps): React.JSX.Element {
|
||||
|
||||
// Load waypoints with double-safe fallback
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
||||
// 1. Try localStorage
|
||||
const saved = localStorage.getItem("la-fabrik-waypoints");
|
||||
if (saved) {
|
||||
@@ -111,7 +113,10 @@ export function TestMap({ onOctreeReady }: TestMapProps): React.JSX.Element {
|
||||
console.log(
|
||||
`[TestMap] ${parsed.length} waypoints chargés depuis localStorage.`,
|
||||
);
|
||||
setWaypoints(parsed);
|
||||
// Schedule state update to avoid synchronous setState in effect
|
||||
queueMicrotask(() => {
|
||||
if (!cancelled) setWaypoints(parsed);
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -129,6 +134,7 @@ export function TestMap({ onOctreeReady }: TestMapProps): React.JSX.Element {
|
||||
throw new Error("Impossible de charger /roadNetwork.json");
|
||||
})
|
||||
.then((data) => {
|
||||
if (cancelled) return;
|
||||
if (Array.isArray(data)) {
|
||||
console.log(
|
||||
`[TestMap] ${data.length} waypoints chargés depuis /roadNetwork.json.`,
|
||||
@@ -139,6 +145,10 @@ export function TestMap({ onOctreeReady }: TestMapProps): React.JSX.Element {
|
||||
.catch((err) => {
|
||||
console.log("[TestMap] Aucun point d'A* trouvé par défaut.", err);
|
||||
});
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user