Fix ESLint errors: remove setState-in-effect and unused parameters#2
Conversation
- HomeClient.tsx: Replaced useEffect setState with derived state - HeroScene.tsx: Removed unused isMobile parameter - HeroScene.tsx: Added shadowsEnabled to useLayoutEffect dependencies - HeroScene.tsx: Removed unused onFocusAction parameter Co-authored-by: Kinin-Code-Offical <125186556+Kinin-Code-Offical@users.noreply.github.com>
Moved virtualKeysOpen state declaration before scroll callback and clear it directly in the event handler when dock becomes hidden, preserving original behavior while avoiding cascading renders Co-authored-by: Kinin-Code-Offical <125186556+Kinin-Code-Offical@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes ESLint hook/unused-parameter findings by removing unused component parameters, correcting a hook dependency list, and restructuring HomeClient to avoid setState inside a useEffect.
Changes:
HomeClient.tsx: Removes theuseEffectthat synchronously closedvirtualKeysOpenand instead closes it from the scroll handler when the dock transitions hidden.HeroScene.tsx: Removes unused parameters (isMobile,onFocusAction) and addsshadowsEnabledto auseLayoutEffectdependency array.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/components/HomeClient.tsx |
Eliminates setState-in-useEffect by closing virtual keys from the scroll-driven dock visibility transition. |
src/components/hero/HeroScene.tsx |
Removes unused parameters and updates hook dependencies to satisfy ESLint rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| scene, | ||
| setPlaneColor, | ||
| usePhoneRig, | ||
| shadowsEnabled, |
There was a problem hiding this comment.
shadowsEnabled was added to this useLayoutEffect dependency list, but the effect does a full scene.traverse(...) and also calls onDebugAction(...) every time it runs. Since shadowsEnabled toggles with interactionActive/enhancedLighting, this can cause repeated expensive traversals and repeated debug callbacks (in HomeClient, onDebugAction updates modelReadyAt, which can delay the boot timing). Consider removing all shadowsEnabled usage from this layout effect (it’s only used to set castShadow/receiveShadow) and rely on the existing useEffect([scene, shadowsEnabled]) below to apply shadow flags, so shadow toggles don’t retrigger the heavy layout pass.
| shadowsEnabled, |
Resolves 1 error and 3 warnings flagged by ESLint related to React hooks and unused variables.
Changes
HomeClient.tsx - Eliminated cascading render from setState-in-effect
virtualKeysOpenstate declaration before scroll callback to enable direct accesssetVirtualKeysOpen(false)directly in scroll handler whendockKeysVisibletransitions to falseuseEffectthat was calling setState synchronouslyHeroScene.tsx - Cleaned up unused parameters and missing dependencies
isMobileparameter fromComputerModelfunction and call siteonFocusActionparameter fromSceneContentfunctionshadowsEnabledtouseLayoutEffectdependency arrayWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.com/usr/local/bin/node node /home/REDACTED/work/kinin-code/kinin-code/node_modules/.bin/next build(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.