Skip to content

Commit 40689a8

Browse files
committed
[database] Simplify destructuring
1 parent 6826054 commit 40689a8

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

database/useList.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ export const useListVals = <
147147
// that `options` is memoized. If `options` was passed directly then it
148148
// would cause the values to be recalculated every time the whole
149149
// `options object changed
150-
const keyField = options?.keyField || undefined;
151-
const refField = options?.refField || undefined;
152-
const transform = options?.transform || undefined;
150+
const { keyField, refField, transform } = options ?? {};
153151

154152
const [snapshots, loading, error] = useList(query);
155153
const values = useMemo(

database/useObject.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ export const useObjectVal = <
4141
// that `options` is memoized. If `options` was passed directly then it
4242
// would cause the values to be recalculated every time the whole
4343
// `options object changed
44-
const keyField = options?.keyField || undefined;
45-
const refField = options?.refField || undefined;
46-
const transform = options?.transform || undefined;
44+
const { keyField, refField, transform } = options ?? {};
4745

4846
const [snapshot, loading, error] = useObject(query);
4947
const value = useMemo(

0 commit comments

Comments
 (0)