assets without objects
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user