feat: refactor unarchive handling to support bulk unarchive and update prop types

This commit is contained in:
shuaiplus
2026-03-23 08:40:40 +08:00
parent 0fc7bd7985
commit 8b07cd4409
2 changed files with 8 additions and 15 deletions
+1 -8
View File
@@ -703,19 +703,12 @@ function folderName(id: string | null | undefined): string {
async function handleUnarchiveSelected(cipher: Cipher): Promise<void> {
setBusy(true);
try {
await props.onUnarchive(cipher);
if (sidebarFilter.kind === 'archive') {
const remaining = filteredCiphers.filter((item) => item.id !== cipher.id);
await props.onBulkUnarchive([cipher.id]);
setSelectedMap((prev) => {
const next = { ...prev };
delete next[cipher.id];
return next;
});
setSelectedCipherId(remaining[0]?.id || '');
if (isMobileLayout && remaining.length === 0) {
setMobilePanel('list');
}
}
} finally {
setBusy(false);
}
@@ -31,8 +31,8 @@ interface VaultDetailViewProps {
onDownloadAttachment: (cipher: Cipher, attachmentId: string) => void;
onStartEdit: () => void;
onDelete: (cipher: Cipher) => void;
onArchive: (cipher: Cipher) => Promise<void>;
onUnarchive: (cipher: Cipher) => Promise<void>;
onArchive: (cipher: Cipher) => void | Promise<void>;
onUnarchive: (cipher: Cipher) => void | Promise<void>;
}
export default function VaultDetailView(props: VaultDetailViewProps) {