fix(core): remove unexpected duplicate notification (#6477)
close TOV-775
This commit is contained in:
@@ -69,30 +69,29 @@ export const Component = function CollectionPage() {
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const workspace = useService(Workspace);
|
const workspace = useService(Workspace);
|
||||||
const collection = collections.find(v => v.id === params.collectionId);
|
const collection = collections.find(v => v.id === params.collectionId);
|
||||||
|
|
||||||
|
const notifyCollectionDeleted = useCallback(() => {
|
||||||
|
navigate.jumpToSubPath(workspace.id, WorkspaceSubPath.ALL);
|
||||||
|
const collection = collectionService.collectionsTrash$.value.find(
|
||||||
|
v => v.collection.id === params.collectionId
|
||||||
|
);
|
||||||
|
let text = 'Collection does not exist';
|
||||||
|
if (collection) {
|
||||||
|
if (collection.userId) {
|
||||||
|
text = `${collection.collection.name} has been deleted by ${collection.userName}`;
|
||||||
|
} else {
|
||||||
|
text = `${collection.collection.name} has been deleted`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return notify.error({ title: text });
|
||||||
|
}, [collectionService, navigate, params.collectionId, workspace.id]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!collection) {
|
if (!collection) {
|
||||||
navigate.jumpToSubPath(workspace.id, WorkspaceSubPath.ALL);
|
notifyCollectionDeleted();
|
||||||
const collection = collectionService.collectionsTrash$.value.find(
|
|
||||||
v => v.collection.id === params.collectionId
|
|
||||||
);
|
|
||||||
let text = 'Collection does not exist';
|
|
||||||
if (collection) {
|
|
||||||
if (collection.userId) {
|
|
||||||
text = `${collection.collection.name} has been deleted by ${collection.userName}`;
|
|
||||||
} else {
|
|
||||||
text = `${collection.collection.name} has been deleted`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notify.error({ title: text });
|
|
||||||
}
|
}
|
||||||
}, [
|
}, [collection, notifyCollectionDeleted]);
|
||||||
collection,
|
|
||||||
collectionService.collectionsTrash$.value,
|
|
||||||
navigate,
|
|
||||||
params.collectionId,
|
|
||||||
workspace.docCollection,
|
|
||||||
workspace.id,
|
|
||||||
]);
|
|
||||||
if (!collection) {
|
if (!collection) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user