cleanup
This commit is contained in:
@@ -21,7 +21,7 @@ interface AssetLike {
|
||||
type EnsureAssetUrl = (
|
||||
documentId: Identifier,
|
||||
asset: AssetLike,
|
||||
options?: { start?: number; limit?: number; [key: string]: unknown },
|
||||
options?: { force?: boolean; [key: string]: unknown },
|
||||
) => Promise<unknown>;
|
||||
|
||||
type GetDocumentAsset = (document: DocumentLike | null, assetType: string) => AssetLike | null;
|
||||
|
||||
@@ -19,7 +19,7 @@ interface PreviewMetadataEntry {
|
||||
}
|
||||
|
||||
type GetDocumentAsset = (doc: DocumentLike, type: string) => AssetLike | null;
|
||||
type EnsureAssetUrl = (docId: string | number, asset: AssetLike, options?: { start?: number; limit?: number }) => Promise<AssetLike | null>;
|
||||
type EnsureAssetUrl = (docId: string | number, asset: AssetLike, options?: { force?: boolean }) => Promise<AssetLike | null>;
|
||||
|
||||
const usePreviewMetadata = (
|
||||
documents: DocumentLike[] | null,
|
||||
@@ -58,7 +58,7 @@ const usePreviewMetadata = (
|
||||
|
||||
if (!hasDimensions(metadata) && ensureAssetUrl && docId && asset?.id) {
|
||||
try {
|
||||
const ensured = await ensureAssetUrl(doc.id, asset, { start: 1, limit: 1 });
|
||||
const ensured = await ensureAssetUrl(doc.id, asset, { force: true });
|
||||
if (ensured) {
|
||||
asset = ensured;
|
||||
view = createAssetView(asset);
|
||||
|
||||
@@ -134,8 +134,6 @@ interface UseDocumentMutationsArgs {
|
||||
closeDocumentPreview: CloseDocumentPreview;
|
||||
previewDocumentId?: DocumentId | null;
|
||||
refreshCurrentFolder: () => Promise<void>;
|
||||
refreshVisibleDocuments: () => Promise<void>;
|
||||
documentsViewMode?: string;
|
||||
updateDocumentCaches: UpdateDocumentCaches;
|
||||
tagLookupById: Map<DocumentId, Tag>;
|
||||
tags: Tag[];
|
||||
@@ -212,8 +210,6 @@ const useDocumentMutations = ({
|
||||
closeDocumentPreview,
|
||||
previewDocumentId,
|
||||
refreshCurrentFolder,
|
||||
refreshVisibleDocuments,
|
||||
documentsViewMode,
|
||||
updateDocumentCaches,
|
||||
tagLookupById,
|
||||
tags,
|
||||
@@ -641,7 +637,7 @@ const useDocumentMutations = ({
|
||||
notifyApiError(error, 'Failed to assign tag.');
|
||||
}
|
||||
},
|
||||
[api, tags, refreshTags, attachTagToDocument, notifyApiError, setStatusMessage, tagManager],
|
||||
[api, tags, refreshTags, attachTagToDocument, notifyApiError, tagManager],
|
||||
);
|
||||
|
||||
const handleDocumentTagAttach = useCallback(
|
||||
|
||||
@@ -366,7 +366,6 @@ const useDocumentsWorkspace = ({
|
||||
activeCorrespondentFilters,
|
||||
setActiveCorrespondentFilters,
|
||||
isFilterActive,
|
||||
refetchSearchResults,
|
||||
documentsFilterValue,
|
||||
} = useDocumentsSearch({
|
||||
api,
|
||||
@@ -602,14 +601,6 @@ const useDocumentsWorkspace = ({
|
||||
}
|
||||
}, [selectedFolder, ensureFolderData, applySelectedFolder, notifyApiError]);
|
||||
|
||||
const refreshVisibleDocuments = useCallback(async () => {
|
||||
if (showingSearchResults) {
|
||||
await refetchSearchResults();
|
||||
return;
|
||||
}
|
||||
await refreshCurrentFolder();
|
||||
}, [showingSearchResults, refetchSearchResults, refreshCurrentFolder]);
|
||||
|
||||
const {
|
||||
handleBulkTagAddFromDetail,
|
||||
handleBulkTagRemoveFromDetail,
|
||||
@@ -854,8 +845,6 @@ const useDocumentsWorkspace = ({
|
||||
closeDocumentPreview,
|
||||
previewDocumentId,
|
||||
refreshCurrentFolder,
|
||||
refreshVisibleDocuments,
|
||||
documentsViewMode,
|
||||
updateDocumentCaches,
|
||||
tagLookupById,
|
||||
tags,
|
||||
|
||||
@@ -61,7 +61,7 @@ interface DocumentViewerPanelProps extends DocumentSummarySectionProps {
|
||||
contentType?: string | null;
|
||||
filename?: string | null;
|
||||
} | null;
|
||||
ensureAssetUrl?: (docId: string | number, asset: AssetLike, options?: { start?: number; limit?: number }) => Promise<unknown>;
|
||||
ensureAssetUrl?: (docId: string | number, asset: AssetLike, options?: { force?: boolean }) => Promise<unknown>;
|
||||
getDocumentAsset?: (doc: DocumentLike | null, type: string) => AssetLike | null;
|
||||
ensurePreviewData?: (docId: string | number, options?: { signal?: AbortSignal }) => Promise<DocumentLike | null>;
|
||||
resolveApiPath?: (path: string) => string;
|
||||
@@ -210,7 +210,7 @@ const DocumentViewerPanel: React.FC<DocumentViewerPanelProps> = ({
|
||||
let url = updateUrl();
|
||||
|
||||
if (!url && document.id && asset?.id && ensureAssetUrl) {
|
||||
await ensureAssetUrl(document.id, asset, { start: 1, limit: 1 });
|
||||
await ensureAssetUrl(document.id, asset, { force: true });
|
||||
if (signal?.aborted) {
|
||||
throw new DOMException('Aborted', 'AbortError');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user