[Refactor] Fix ESLint errors and performance warnings in Editor
Context
Our recent CI/lint runs have identified several critical warnings and errors across the editor features. These range from simple formatting fixes to complex React lifecycle issues that could cause performance degradation (cascading renders) or stale state bugs.
Identified Issues
1. 🚀 Critical: Performance & Logic
- Cascading Renders (
MainCanvas.tsx:226): We are calling setState synchronously inside a useEffect. This triggers double-renders and must be refactored (likely by moving logic to event handlers or using useMemo).
- Stale Closures / Missing Dependencies: Multiple files (
EditorApp.tsx, MainCanvas.tsx) have useEffect hooks with missing dependencies. This leads to bugs where the editor doesn't react to state changes (like wallId or selectedObjId).
- Unnecessary Re-renders:
holdModelsGLBURL in EditorApp.tsx needs to be wrapped in useMemo to prevent downstream effects from firing on every render.
2. 🛡️ Type Safety & Code Quality
any Overuse: Extensive use of any in AddHoldModal.tsx, FileManager.tsx, and HoldInspector.tsx. These should be replaced with proper TypeScript interfaces (e.g., Hold, Wall, or Vector3).
- Const Correctness: Variables like
parentQ and newId in MainCanvas.tsx are declared with let but never reassigned.
Checklist
EditorApp.tsx
MainCanvas.tsx
Component Cleanup (Type Safety)
Files to touch
frontend/src/features/editor/EditorApp.tsx
frontend/src/features/editor/components/MainCanvas.tsx
frontend/src/features/editor/components/AddHoldModal.tsx
frontend/src/features/editor/components/FileManager.tsx
frontend/src/features/editor/components/HoldInspector.tsx
How to verify
Run the following command in the frontend directory:
Any questions ?
https://discord.gg/BdyfNU9TpR
[Refactor] Fix ESLint errors and performance warnings in Editor
Context
Our recent CI/lint runs have identified several critical warnings and errors across the editor features. These range from simple formatting fixes to complex React lifecycle issues that could cause performance degradation (cascading renders) or stale state bugs.
Identified Issues
1. 🚀 Critical: Performance & Logic
MainCanvas.tsx:226): We are callingsetStatesynchronously inside auseEffect. This triggers double-renders and must be refactored (likely by moving logic to event handlers or usinguseMemo).EditorApp.tsx,MainCanvas.tsx) haveuseEffecthooks with missing dependencies. This leads to bugs where the editor doesn't react to state changes (likewallIdorselectedObjId).holdModelsGLBURLinEditorApp.tsxneeds to be wrapped inuseMemoto prevent downstream effects from firing on every render.2. 🛡️ Type Safety & Code Quality
anyOveruse: Extensive use ofanyinAddHoldModal.tsx,FileManager.tsx, andHoldInspector.tsx. These should be replaced with proper TypeScript interfaces (e.g.,Hold,Wall, orVector3).parentQandnewIdinMainCanvas.tsxare declared withletbut never reassigned.Checklist
EditorApp.tsx
wallIdtouseEffectdependencies.holdModelsGLBURLinuseMemo.anytype at line 96.MainCanvas.tsx
setStatefrom effect).react-hooks/exhaustive-depswarnings.parentQandnewIdtoconst.anydeclarations.Component Cleanup (Type Safety)
anywith specific types.any.Files to touch
frontend/src/features/editor/EditorApp.tsxfrontend/src/features/editor/components/MainCanvas.tsxfrontend/src/features/editor/components/AddHoldModal.tsxfrontend/src/features/editor/components/FileManager.tsxfrontend/src/features/editor/components/HoldInspector.tsxHow to verify
Run the following command in the
frontenddirectory:Any questions ?
https://discord.gg/BdyfNU9TpR