You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(modes): resolve react-hooks/exhaustive-deps in window message listener
Use a stable ref to hold the latest switchMode and avoid capturing it in the window "message" listener closure:
Add a switchModeRef updated via useEffect; call switchModeRef.current in the importModeResult fallback instead of switchMode
Mirrors existing handleModeSwitchRef/customModesRef pattern to keep handler stable while accessing fresh values
Prevents re-registration churn and removes the ESLint warning with no runtime behavior change
File touched:
webview-ui/src/components/modes/ModesView.tsx
Why:
The effect that registers the window event listener intentionally has an empty dependency array; directly referencing switchMode violates react-hooks/exhaustive-deps. Using a ref decouples the effect from function identity changes while preserving up-to-date behavior.
0 commit comments