feat: Implement asynchronous tag operations with user feedback

This commit is contained in:
2025-12-09 23:13:18 +01:00
parent 3ccc1f6698
commit 1d8d55144f
5 changed files with 123 additions and 31 deletions
@@ -1,10 +1,12 @@
import { useMemo, useCallback, useRef } from 'react';
import { useMemo, useCallback, useRef, useEffect } from 'react';
import type { DocumentsPanelInnerProps } from './DocumentsPanel';
import { isPointerModifierEvent, isPrimaryPointerEvent } from '../features/selection/useEntryPointer';
import { useDocumentsFilter } from '../context/DocumentsFilterContext';
import { useWorkspaceSelectionContext } from '../../app/WorkspaceSelectionContext';
import type { Identifier } from '../../types/identifiers';
import { useStatusToast } from '../../lib/context/StatusToastContext';
import { useTagInteractions } from '../interactions/useTagInteractions';
import { subscribeToToast } from '../features/tagging/tagTransfer';
const EntryType = {
folder: 'folder',
@@ -40,6 +42,15 @@ export const useDocumentsContextValues = (props: DocumentsPanelInnerProps) => {
const scrollRef = useRef<HTMLElement | null>(null);
const suppressDocumentClickRef = useRef(false);
const { showToast } = useStatusToast();
// Subscribe to tag operation results
useEffect(() => {
return subscribeToToast((message, type) => {
showToast(message, type);
});
}, [showToast]);
// Handlers
const tagHandlers = useTagInteractions({
onAssignTagToDocument: props.onDocumentTagAttach,