fix/suppress new react-hooks/preserve-manual-memoization errors

eslint-plugin-react-hooks bumped from 7.0.1 to 7.1.1 under pnpm resolution,
which tightened preserve-manual-memoization.

Real fixes:
- RichTextTag: correct typo'd optional chain in deps array
- ContentHider: match post-guard narrowing in deps array
- ProfileHoverCard: add (stable) dispatch to deps arrays

Bulk-suppress the remaining 6 cases where the compiler can't preserve
memoization across a memo boundary; those need real refactors, follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-05-12 15:12:01 +03:00
parent 9a3e7a2f50
commit 9b4c888195
4 changed files with 22 additions and 8 deletions
+14
View File
@@ -147,6 +147,9 @@
"src/components/dialogs/PostInteractionSettingsDialog.tsx": { "src/components/dialogs/PostInteractionSettingsDialog.tsx": {
"@typescript-eslint/no-explicit-any": { "@typescript-eslint/no-explicit-any": {
"count": 2 "count": 2
},
"react-hooks/preserve-manual-memoization": {
"count": 1
} }
}, },
"src/components/dialogs/lists/CreateOrEditListDialog.tsx": { "src/components/dialogs/lists/CreateOrEditListDialog.tsx": {
@@ -397,6 +400,9 @@
"src/screens/PostThread/index.tsx": { "src/screens/PostThread/index.tsx": {
"@typescript-eslint/no-explicit-any": { "@typescript-eslint/no-explicit-any": {
"count": 2 "count": 2
},
"react-hooks/preserve-manual-memoization": {
"count": 1
} }
}, },
"src/screens/Profile/Header/EditProfileDialog.tsx": { "src/screens/Profile/Header/EditProfileDialog.tsx": {
@@ -542,6 +548,9 @@
"src/view/com/composer/Composer.tsx": { "src/view/com/composer/Composer.tsx": {
"@typescript-eslint/no-explicit-any": { "@typescript-eslint/no-explicit-any": {
"count": 2 "count": 2
},
"react-hooks/preserve-manual-memoization": {
"count": 3
} }
}, },
"src/view/com/composer/drafts/state/queries.ts": { "src/view/com/composer/drafts/state/queries.ts": {
@@ -594,6 +603,11 @@
"count": 4 "count": 4
} }
}, },
"src/view/com/pager/Pager.web.tsx": {
"react-hooks/preserve-manual-memoization": {
"count": 1
}
},
"src/view/com/pager/PagerWithHeader.tsx": { "src/view/com/pager/PagerWithHeader.tsx": {
"@typescript-eslint/no-explicit-any": { "@typescript-eslint/no-explicit-any": {
"count": 3 "count": 3
@@ -288,24 +288,24 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
didFireHover.current = true didFireHover.current = true
dispatch('hovered-target') dispatch('hovered-target')
} }
}, [prefetchIfNeeded]) }, [prefetchIfNeeded, dispatch])
const onPointerLeaveTarget = useCallback(() => { const onPointerLeaveTarget = useCallback(() => {
didFireHover.current = false didFireHover.current = false
dispatch('unhovered-target') dispatch('unhovered-target')
}, []) }, [dispatch])
const onPointerEnterCard = useCallback(() => { const onPointerEnterCard = useCallback(() => {
dispatch('hovered-card') dispatch('hovered-card')
}, []) }, [dispatch])
const onPointerLeaveCard = useCallback(() => { const onPointerLeaveCard = useCallback(() => {
dispatch('unhovered-card') dispatch('unhovered-card')
}, []) }, [dispatch])
const onPress = useCallback(() => { const onPress = useCallback(() => {
dispatch('pressed') dispatch('pressed')
}, []) }, [dispatch])
const isVisible = const isVisible =
currentState.stage === 'showing' || currentState.stage === 'showing' ||
+2 -2
View File
@@ -62,7 +62,7 @@ export function RichTextTag({
optimisticUpsert?.find( optimisticUpsert?.find(
m => m.value === tag && m.targets.includes('tag'), m => m.value === tag && m.targets.includes('tag'),
)) && )) &&
!optimisticRemove?.find(m => m?.value === tag), !optimisticRemove?.find(m => m?.value === tag),
) )
/* /*
@@ -74,7 +74,7 @@ export function RichTextTag({
return word.value === tag return word.value === tag
}) || [] }) || []
) )
}, [tag, preferences?.moderationPrefs?.mutedWords]) }, [tag, preferences?.moderationPrefs.mutedWords])
return ( return (
<Menu.Root> <Menu.Root>
+1 -1
View File
@@ -139,7 +139,7 @@ function ContentHiderActive({
return [...new Set(selfBlurNames)].join(', ') return [...new Set(selfBlurNames)].join(', ')
}, [ }, [
_, _,
modui?.blurs, modui.blurs,
blur, blur,
desc.name, desc.name,
desc.isSubjectAccount, desc.isSubjectAccount,