Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getPaged: async ({ size, start }, { hasMoreUsers, isLoadingUsers }) => {
// console.log('wait.getPaged', { hasMoreUsers, isLoadingUsers });
if (isLoadingUsers) {
// console.log('TODO: Already loading');
return;
}
if (!hasMoreUsers) {
console.log('TODO: No More data');
return;
}
dispatch.isLoadingUsers.start();
const { data, cursor } = await Fire.shared.getUsersPaged({
size,
start: start || _lastPagedCursor,
});
console.log('users.getPaged: ', data.length, !!_lastPagedCursor);
_hasMore = data.length === size;
dispatch.hasMoreUsers.set(_hasMore);
_lastPagedCursor = cursor;
let i = 0;
for (const user of data) {
const nextUser = {
...filterUser(user),
ensured: Date.now(),
dispatch.hasMoreUsers.set(_hasMore);
_lastPagedCursor = cursor;
let i = 0;
for (const user of data) {
const nextUser = {
...filterUser(user),
ensured: Date.now(),
};
console.log('users.getPaged.loop: ', i, nextUser);
dispatch.users.update({ user: nextUser });
i++;
}
dispatch.isLoadingUsers.end();
},
refreshAsync: async ({ callback: _cb }, { users }) => {
_onRefresh = () => {
this.setState({ refreshing: true });
dispatch.hasMoreUsers.clear();
dispatch.isLoadingUsers.end();
dispatch.users.refreshAsync({
callback: () => this.setState({ refreshing: false }),
});
};