Fix infinite loop when opening relation picker in comments pane (#548)

* Typo

* Remove hotkeys for relation picker
This commit is contained in:
Emilien Chauvet 2023-07-08 20:09:00 -07:00 committed by GitHub
parent fffb8c99cb
commit 49c20907e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 9 deletions

View File

@ -12,7 +12,6 @@ import { IconArrowUpRight } from '@tabler/icons-react';
import { CommentThreadForDrawer } from '@/comments/types/CommentThreadForDrawer'; import { CommentThreadForDrawer } from '@/comments/types/CommentThreadForDrawer';
import CompanyChip from '@/companies/components/CompanyChip'; import CompanyChip from '@/companies/components/CompanyChip';
import { useHotkeysScopeOnBooleanState } from '@/hotkeys/hooks/useHotkeysScopeOnBooleanState';
import { useScopedHotkeys } from '@/hotkeys/hooks/useScopedHotkeys'; import { useScopedHotkeys } from '@/hotkeys/hooks/useScopedHotkeys';
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope'; import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
import { PersonChip } from '@/people/components/PersonChip'; import { PersonChip } from '@/people/components/PersonChip';
@ -98,11 +97,6 @@ export function CommentThreadRelationPicker({ commentThread }: OwnProps) {
const [isMenuOpen, setIsMenuOpen] = useState(false); const [isMenuOpen, setIsMenuOpen] = useState(false);
const [searchFilter, setSearchFilter] = useState(''); const [searchFilter, setSearchFilter] = useState('');
useHotkeysScopeOnBooleanState(
{ scope: InternalHotkeysScope.RelationPicker },
isMenuOpen,
);
const theme = useTheme(); const theme = useTheme();
const peopleIds = const peopleIds =

View File

@ -10,17 +10,17 @@ export function useHotkeysScopeOnBooleanState(
booleanState: boolean, booleanState: boolean,
) { ) {
const addToHotkeysScopeStack = useAddToHotkeysScopeStack(); const addToHotkeysScopeStack = useAddToHotkeysScopeStack();
const removeFromHoteysScopeStack = useRemoveFromHotkeysScopeStack(); const removeFromHotkeysScopeStack = useRemoveFromHotkeysScopeStack();
useEffect(() => { useEffect(() => {
if (booleanState) { if (booleanState) {
addToHotkeysScopeStack(hotkeysScopeStackItem); addToHotkeysScopeStack(hotkeysScopeStackItem);
} else { } else {
removeFromHoteysScopeStack(hotkeysScopeStackItem.scope); removeFromHotkeysScopeStack(hotkeysScopeStackItem.scope);
} }
}, [ }, [
hotkeysScopeStackItem, hotkeysScopeStackItem,
removeFromHoteysScopeStack, removeFromHotkeysScopeStack,
addToHotkeysScopeStack, addToHotkeysScopeStack,
booleanState, booleanState,
]); ]);