feat: Implement asynchronous tag operations with user feedback
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user