From 0b84b825b6b2699b7cd9eca12cc4e4601fb09a4b Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 16 Dec 2022 16:48:48 -0600 Subject: [PATCH] fileStorage/hooks: fix deps on useFileStorageUuid This way if the path changes, we get the correct result. --- src/fileStorage/hooks.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/fileStorage/hooks.ts b/src/fileStorage/hooks.ts index 66e9ed6d..498a0d19 100644 --- a/src/fileStorage/hooks.ts +++ b/src/fileStorage/hooks.ts @@ -33,10 +33,12 @@ export function useFileStoragePath(uuid: UUID): string | undefined { */ export function useFileStorageUuid(path: string): UUID | undefined { const db = useContext(FileStorageContext); - return useLiveQuery(() => - db.metadata - .where('path') - .equals(path) - .first((x) => x?.uuid), + return useLiveQuery( + () => + db.metadata + .where('path') + .equals(path) + .first((x) => x?.uuid), + [path], ); }