Phase A: clear all react-hooks/exhaustive-deps warnings via useEffectEvent or hoisting

Eliminate the four remaining missing-dependency warnings reported by
react-hooks v7. Each one was a real stale-closure or re-trigger hazard;
the fix matches the intent rather than just silencing the linter.

- src/App.tsx (line 448): wrap showSessionExpired with useEffectEvent
  (onSessionExpired) so the prepare effect doesn't re-run on every
  showSessionExpired identity change but still calls the latest
  callback. Replace the two in-effect call sites.
- src/components/furni-editor/views/FurniEditorSearchView.tsx: wrap
  the on-mount onSearch('', '', 1) call with useEffectEvent so the
  callback prop isn't a missing dependency.
- src/components/notification-center/views/bubble-layouts/
  NotificationBadgeReceivedBubbleView.tsx: wrap the
  "fetch badges only if empty on mount" check with useEffectEvent
  so badgeCodes.length isn't required as a dep (and won't re-fetch
  every count change).
- src/components/navigator/views/room-settings/
  NavigatorRoomSettingsRightsTabView.tsx: switch deps from
  roomData?.roomId to roomData (the body uses roomData.roomId after
  an early return; the linter wanted the whole object).
- src/api/ui-settings/UiSettingsContext.tsx: hoist ALL_CSS_VARS
  outside the component (it's a static constant).

After this, yarn eslint reports zero exhaustive-deps warnings across
the whole src/.

https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q
This commit is contained in:
simoleo89
2026-05-11 16:31:51 +00:00
parent f18c917fc4
commit d382635597
5 changed files with 24 additions and 15 deletions
@@ -1,5 +1,5 @@
import { RequestBadgesComposer } from '@nitrots/nitro-renderer';
import { FC, useEffect } from 'react';
import { FC, useEffect, useEffectEvent } from 'react';
import { LocalizeText, NotificationBubbleItem, SendMessageComposer } from '../../../../api';
import { Flex, LayoutNotificationBubbleView, LayoutNotificationBubbleViewProps, Text } from '../../../../common';
import { useInventoryBadges } from '../../../../hooks';
@@ -14,9 +14,14 @@ export const NotificationBadgeReceivedBubbleView: FC<NotificationBadgeReceivedBu
const { item = null, onClose = null, ...rest } = props;
const { badgeCodes = [], toggleBadge = null } = useInventoryBadges();
useEffect(() =>
const requestBadgesIfEmpty = useEffectEvent(() =>
{
if(badgeCodes.length === 0) SendMessageComposer(new RequestBadgesComposer());
});
useEffect(() =>
{
requestBadgesIfEmpty();
}, []);
const handleWear = (event: React.MouseEvent) =>