How to use the @rematch/core.dispatch.hasMoreUsers function in @rematch/core

To help you get started, we’ve selected a few @rematch/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EvanBacon / pro-chat / client / src / rematch / users.js View on Github external
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(),
        };

        console.log('users.getPaged.loop: ', i, nextUser);

        dispatch.users.update({ user: nextUser });
        i++;
      }

      dispatch.isLoadingUsers.end();
    },
github EvanBacon / pro-chat / client / src / components / MatchesList.js View on Github external
_onRefresh = () => {
    this.setState({ refreshing: true });

    dispatch.hasMoreUsers.clear();
    dispatch.isLoadingUsers.end();

    dispatch.users.refreshAsync({
      callback: () => this.setState({ refreshing: false }),
    });
  };