Print error from usePagination

This commit is contained in:
James Grugett 2022-10-05 15:12:03 -05:00
parent 4bbadeb27c
commit b40a114168

View File

@ -91,9 +91,15 @@ export const usePagination = <T>(opts: PaginationOptions<T>) => {
const nextQ = lastDoc const nextQ = lastDoc
? query(state.baseQ, startAfter(lastDoc), limit(state.pageSize)) ? query(state.baseQ, startAfter(lastDoc), limit(state.pageSize))
: query(state.baseQ, limit(state.pageSize)) : query(state.baseQ, limit(state.pageSize))
return onSnapshot(nextQ, (snapshot) => { return onSnapshot(
dispatch({ type: 'LOAD', snapshot }) nextQ,
}) (snapshot) => {
dispatch({ type: 'LOAD', snapshot })
},
(error) => {
console.error('error', error)
}
)
} }
}, [state.isLoading, state.baseQ, state.docs, state.pageSize]) }, [state.isLoading, state.baseQ, state.docs, state.pageSize])