fileStorage/hooks: fix deps on useFileStorageUuid

This way if the path changes, we get the correct result.
This commit is contained in:
David Lechner
2022-12-16 17:54:36 -06:00
committed by David Lechner
parent 78b962d397
commit 0b84b825b6
+7 -5
View File
@@ -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],
);
}