Compare commits
3 Commits
d9e9a6722a
...
d6caee5b42
Author | SHA1 | Date |
---|---|---|
Keyan | d6caee5b42 | |
ekzyis | 0901f15249 | |
ekzyis | 58c37bbd63 |
|
@ -173,7 +173,7 @@ function tag (walletDef) {
|
|||
}
|
||||
|
||||
export function useWalletLogs (wallet, initialPage = 1, logsPerPage = 10) {
|
||||
const [logs, setLogs] = useState([])
|
||||
const [logs, _setLogs] = useState([])
|
||||
const [page, setPage] = useState(initialPage)
|
||||
const [hasMore, setHasMore] = useState(true)
|
||||
const [total, setTotal] = useState(0)
|
||||
|
@ -183,6 +183,14 @@ export function useWalletLogs (wallet, initialPage = 1, logsPerPage = 10) {
|
|||
const { getPage, error, notSupported } = useWalletLogDB()
|
||||
const [getWalletLogs] = useLazyQuery(WALLET_LOGS, SSR ? {} : { fetchPolicy: 'cache-and-network' })
|
||||
|
||||
const setLogs = useCallback((action) => {
|
||||
_setLogs(action)
|
||||
// action can be a React state dispatch function
|
||||
const newLogs = typeof action === 'function' ? action(logs) : action
|
||||
// make sure 'more' button is removed if logs were deleted
|
||||
if (newLogs.length === 0) setHasMore(false)
|
||||
}, [logs, _setLogs, setHasMore])
|
||||
|
||||
const loadLogsPage = useCallback(async (page, pageSize, walletDef) => {
|
||||
try {
|
||||
let result = { data: [], hasMore: false }
|
||||
|
|
Loading…
Reference in New Issue