Skip to content

Commit 8af577a

Browse files
Ja1zmeclaude
andcommitted
fix(lint): corregir 3 errores ESLint react-hooks en DesktopContextMenu, SyncIndicator y SpinningCoinLogo
- SyncIndicator: eliminar useEffect+isMounted innecesario (client component siempre montado) - DesktopContextMenu: inicializar zoom con lazy initializer en lugar de useEffect (evita set-state-in-effect) - SpinningCoinLogo: eslint-disable puntual para mutación de camera.fov (patrón obligatorio de Three.js) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 15a5690 commit 8af577a

3 files changed

Lines changed: 9 additions & 19 deletions

File tree

src/components/desktop/DesktopContextMenu.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
Settings,
1818
} from "lucide-react";
1919
import { useElectron } from "@/hooks/useElectron";
20+
import { isTauriWebView } from "@/lib/desktop";
2021
import { useWidgetStore } from "@/stores/widget-store";
2122
import { useLayoutStore } from "@/stores/layout-store";
2223
import { useLinksStore } from "@/stores/links-store";
@@ -58,7 +59,11 @@ interface MenuState {
5859
export function DesktopContextMenu() {
5960
const { isTauri, minimizeWindow, maximizeWindow, closeWindow } = useElectron();
6061
const [menu, setMenu] = useState<MenuState>({ visible: false, x: 0, y: 0 });
61-
const [zoom, setZoom] = useState(1);
62+
const [zoom, setZoom] = useState(() => {
63+
const z = isTauriWebView() ? readZoom() : 1;
64+
if (isTauriWebView()) document.documentElement.style.zoom = `${z}`;
65+
return z;
66+
});
6267
const menuRef = useRef<HTMLDivElement>(null);
6368

6469
const openAddWidgetModal = useWidgetStore((s) => s.openAddWidgetModal);
@@ -67,14 +72,6 @@ export function DesktopContextMenu() {
6772
const toggleEditMode = useLayoutStore((s) => s.toggleEditMode);
6873
const refreshAllData = useLinksStore((s) => s.refreshAllData);
6974

70-
// Aplicar zoom guardado al montar
71-
useEffect(() => {
72-
if (!isTauri) return;
73-
const z = readZoom();
74-
setZoom(z);
75-
document.documentElement.style.zoom = `${z}`;
76-
}, [isTauri]);
77-
7875
const hideMenu = useCallback(() => {
7976
setMenu((m) => ({ ...m, visible: false }));
8077
}, []);

src/components/layout/SpinningCoinLogo.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ function CoinModel({ rotationSpeed = 3.5 }: CoinModelProps) {
2828
groupRef.current.scale.setScalar(scale);
2929
groupRef.current.position.sub(center.multiplyScalar(scale));
3030

31-
// Ajustar cámara
31+
// Ajustar cámara — mutación directa requerida por Three.js/R3F
32+
// eslint-disable-next-line react-hooks/immutability
3233
(camera as THREE.PerspectiveCamera).fov = 50;
3334
camera.updateProjectionMatrix();
3435
}, [camera, scene]);

src/components/layout/SyncIndicator.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useState, useEffect } from "react";
4-
import { Cloud, CloudOff, Loader2 } from "lucide-react";
4+
import { CloudOff, Loader2 } from "lucide-react";
55
import {
66
Tooltip,
77
TooltipContent,
@@ -31,11 +31,6 @@ export function notifySyncStatus(status: SyncStatus) {
3131
export function SyncIndicator() {
3232
const { t } = useTranslation();
3333
const [status, setStatus] = useState<SyncStatus>("saved");
34-
const [isMounted, setIsMounted] = useState(false);
35-
36-
useEffect(() => {
37-
setIsMounted(true);
38-
}, []);
3934

4035
// Suscribirse al sistema de eventos de sincronización
4136
useEffect(() => {
@@ -61,9 +56,6 @@ export function SyncIndicator() {
6156
}
6257
}, [status]);
6358

64-
// No renderizar antes de la hidratación
65-
if (!isMounted) return null;
66-
6759
// En estado "saved" no se muestra nada para no ocupar espacio
6860
if (status === "saved") return null;
6961

0 commit comments

Comments
 (0)