assets without objects

This commit is contained in:
2025-11-20 02:32:11 +01:00
parent 0eb4c0a294
commit 78e6d3e431
6 changed files with 59 additions and 139 deletions
@@ -1025,7 +1025,7 @@ const useDocumentsWorkspace = ({
const ensureAssetUrl = useCallback(
async (documentId, asset, { force = false, start = null, limit = null } = {}) => {
async (documentId, asset, { force = false } = {}) => {
if (!documentId || !asset?.id) {
return null;
}
@@ -1033,8 +1033,6 @@ const useDocumentsWorkspace = ({
try {
const entry = await assetManager.ensureAsset(documentId, asset, {
force,
start,
limit,
});
if (!entry) {
+4 -2
View File
@@ -11,12 +11,14 @@ type DocumentLike = {
type AssetObject = {
url?: string | null;
metadata?: Record<string, unknown> | null;
expires_at?: number | null;
[key: string]: unknown;
};
type AssetLike = {
id?: Identifier;
url?: string | null;
expires_at?: number | null;
metadata?: Record<string, unknown> | null;
objects?: AssetObject[];
[key: string]: unknown;
@@ -25,7 +27,7 @@ type AssetLike = {
type EnsureAssetUrl = (
documentId: Identifier,
asset: AssetLike,
options?: { start?: number; limit?: number; [key: string]: unknown },
options?: { force?: boolean; [key: string]: unknown },
) => Promise<unknown>;
type GetAsset = (document: DocumentLike, assetType: string) => AssetLike | null;
@@ -89,7 +91,7 @@ export const useAssetNavigator = ({
}
let cancelled = false;
setIsLoading(true);
ensureAssetUrl(documentId, asset, { start: 1, limit: 1 })
ensureAssetUrl(documentId, asset, { force: true })
.catch(() => {})
.finally(() => {
if (!cancelled) {