Merge pull request #566 from JulesGuesnon/fix/file-unhighlighting

This commit is contained in:
Brendan Allan 2023-02-10 12:03:15 +08:00 committed by GitHub
commit 808bc9f33a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,7 +117,13 @@ export const VirtualizedList = memo(({ data, context, onScroll }: Props) => {
return ( return (
<div style={{ marginTop: -TOP_BAR_HEIGHT }} className="w-full pl-2 cursor-default"> <div style={{ marginTop: -TOP_BAR_HEIGHT }} className="w-full pl-2 cursor-default">
<div ref={scrollRef} className="h-screen custom-scroll explorer-scroll"> <div
ref={scrollRef}
className="h-screen custom-scroll explorer-scroll"
onClick={(e) => {
getExplorerStore().selectedRowIndex = -1;
}}
>
<div <div
ref={innerRef} ref={innerRef}
style={{ style={{
@ -186,9 +192,14 @@ const WrappedItem = memo(({ item, index, isSelected, kind }: WrappedItemProps) =
if (isPath(item) && item.item.is_dir) setSearchParams({ path: item.item.materialized_path }); if (isPath(item) && item.item.is_dir) setSearchParams({ path: item.item.materialized_path });
}, [item, setSearchParams]); }, [item, setSearchParams]);
const onClick = useCallback(() => { const onClick = useCallback(
getExplorerStore().selectedRowIndex = isSelected ? -1 : index; (e: React.MouseEvent<HTMLDivElement>) => {
}, [isSelected, index]); e.stopPropagation();
getExplorerStore().selectedRowIndex = isSelected ? -1 : index;
},
[isSelected, index]
);
const ItemComponent = kind === 'list' ? FileRow : FileItem; const ItemComponent = kind === 'list' ? FileRow : FileItem;