fix: ctx menu sometimes not opening immediately
This commit is contained in:
@@ -149,6 +149,7 @@ export function DirectoryContentTableContextMenu({
|
|||||||
const setOptimisticDeletedItems = useSetAtom(optimisticDeletedItemsAtom)
|
const setOptimisticDeletedItems = useSetAtom(optimisticDeletedItemsAtom)
|
||||||
const moveToTrashMutation = useContextMutation(api.files.moveToTrash)
|
const moveToTrashMutation = useContextMutation(api.files.moveToTrash)
|
||||||
const setItemBeingRenamed = useSetAtom(itemBeingRenamedAtom)
|
const setItemBeingRenamed = useSetAtom(itemBeingRenamedAtom)
|
||||||
|
const setContextMenuTargetItem = useSetAtom(contextMenuTargeItemAtom)
|
||||||
const { mutate: moveToTrash } = useMutation({
|
const { mutate: moveToTrash } = useMutation({
|
||||||
mutationFn: moveToTrashMutation,
|
mutationFn: moveToTrashMutation,
|
||||||
onMutate: ({ itemId }) => {
|
onMutate: ({ itemId }) => {
|
||||||
@@ -186,7 +187,13 @@ export function DirectoryContentTableContextMenu({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContextMenu>
|
<ContextMenu
|
||||||
|
onOpenChange={(open) => {
|
||||||
|
if (!open) {
|
||||||
|
setContextMenuTargetItem(null)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ContextMenuTrigger asChild>{children}</ContextMenuTrigger>
|
<ContextMenuTrigger asChild>{children}</ContextMenuTrigger>
|
||||||
{target && (
|
{target && (
|
||||||
<ContextMenuContent>
|
<ContextMenuContent>
|
||||||
|
Reference in New Issue
Block a user