feat: Refactor tag drag and drop interactions
This commit is contained in:
@@ -937,32 +937,16 @@ const useDocumentsWorkspace = ({
|
||||
);
|
||||
|
||||
const handleDocumentTagDrop = useCallback(
|
||||
async (documentId, tag) => {
|
||||
if (!documentId || !tag?.id) {
|
||||
async (documentId, tagId) => {
|
||||
if (!documentId || !tagId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tag.sourceDocId && tag.sourceDocId === documentId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const attached = await handleDocumentTagAttach({ documentId, tagId: tag.id, tag });
|
||||
if (!attached) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tag.sourceDocId && tag.sourceDocId !== documentId) {
|
||||
await handleTagRemove(tag.sourceDocId, tag.id, {
|
||||
refreshTagList: false,
|
||||
showMessage: false,
|
||||
});
|
||||
}
|
||||
await handleDocumentTagAttach({ documentId, tagId });
|
||||
},
|
||||
[handleDocumentTagAttach, handleTagRemove],
|
||||
[handleDocumentTagAttach],
|
||||
);
|
||||
|
||||
|
||||
|
||||
const handlePromptCreateFolder = useCallback(async (parentId?: Identifier | null) => {
|
||||
if (creatingFolder) {
|
||||
return;
|
||||
@@ -1214,7 +1198,8 @@ const useDocumentsWorkspace = ({
|
||||
activeCorrespondentFilters,
|
||||
ensureAssetUrl,
|
||||
getDocumentAsset,
|
||||
handleDocumentTagDrop,
|
||||
handleDocumentTagAttach: handleDocumentTagDrop,
|
||||
handleDocumentTagDetach: handleTagRemove,
|
||||
documentsViewMode,
|
||||
documentsSortField,
|
||||
documentsSortDirection,
|
||||
|
||||
Reference in New Issue
Block a user