Skip to content

Commit

Permalink
remove timeout for open folder
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaBondar committed Feb 9, 2024
1 parent 66b6ec9 commit d3b7ee3
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions apps/chat/src/components/Folder/Folder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ const Folder = <T extends ConversationInfo | PromptInfo | DialFile>({
const isExternal = useAppSelector((state) =>
isEntityOrParentsExternal(state, currentFolder, FeatureType.Chat),
);
const openTimeoutRef = useRef<ReturnType<typeof setTimeout>>();

useEffect(() => {
// only if search term was changed after first render
Expand Down Expand Up @@ -359,13 +358,7 @@ const Folder = <T extends ConversationInfo | PromptInfo | DialFile>({
dragDropElement.current?.contains(evt.target as Node) &&
isParentFolder(dragDropElement.current, evt.target as Element)
) {
openTimeoutRef.current = setTimeout(
() =>
dispatch(
UIActions.openFolder({ id: currentFolder.id, featureType }),
),
500,
);
dispatch(UIActions.openFolder({ id: currentFolder.id, featureType }));
setIsDraggingOver(true);
}
},
Expand All @@ -376,15 +369,13 @@ const Folder = <T extends ConversationInfo | PromptInfo | DialFile>({
(evt: DragEvent) => {
if (!dragDropElement.current?.contains(evt.relatedTarget as Node)) {
setIsDraggingOver(false);
clearTimeout(openTimeoutRef.current);
return;
}

if (
!isParentFolder(dragDropElement.current, evt.relatedTarget as Element)
) {
setIsDraggingOver(false);
clearTimeout(openTimeoutRef.current);
}
},
[isParentFolder],
Expand Down

0 comments on commit d3b7ee3

Please sign in to comment.