Skip to content

Commit f06b61f

Browse files
mellowagainclaude
andcommitted
Fix react-hooks/set-state-in-effect lint errors from eslint-config-next bump
The eslint-config-next 16.2.3 -> 16.2.9 bump changed which setState-in-effect calls the rule flags: carousel.tsx and the use-mobile hooks now trigger it (legitimate external-sync-on-mount patterns, suppressed like the existing nier-map/nier-shell cases), while the old suppressions in nier-map.tsx and nier-shell.tsx became unused since the rule no longer flags those. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 7d546d4 commit f06b61f

5 files changed

Lines changed: 3 additions & 2 deletions

File tree

components/nier-map.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export function NierLeafletMap({ locations }: { locations: MapLocation[] }) {
8686
});
8787

8888
mapInstance.current = map;
89-
// eslint-disable-next-line react-hooks/set-state-in-effect
9089
setReady(true);
9190

9291
return () => {

components/nier-shell.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export function NierShell({ children }: { children: React.ReactNode }) {
8282
// Clear navigating state when pathname actually changes
8383
useEffect(() => {
8484
if (prevPathname.current !== pathname) {
85-
// eslint-disable-next-line react-hooks/set-state-in-effect
8685
setIsNavigating(false);
8786
prevPathname.current = pathname;
8887
}

components/ui/carousel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ function Carousel({
9393

9494
React.useEffect(() => {
9595
if (!api) return;
96+
// eslint-disable-next-line react-hooks/set-state-in-effect
9697
onSelect(api);
9798
api.on("reInit", onSelect);
9899
api.on("select", onSelect);

components/ui/use-mobile.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function useIsMobile() {
1111
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
1212
};
1313
mql.addEventListener("change", onChange);
14+
// eslint-disable-next-line react-hooks/set-state-in-effect
1415
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
1516
return () => mql.removeEventListener("change", onChange);
1617
}, []);

hooks/use-mobile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function useIsMobile() {
1111
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
1212
};
1313
mql.addEventListener("change", onChange);
14+
// eslint-disable-next-line react-hooks/set-state-in-effect
1415
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
1516
return () => mql.removeEventListener("change", onChange);
1617
}, []);

0 commit comments

Comments
 (0)