How to use the relay-hooks.useQueryFetcher function in relay-hooks

To help you get started, we’ve selected a few relay-hooks 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 morrys / react-relay-offline / src / hooks / useQueryOffline.ts View on Github external
...ref.current,
          rehydrated: true,
          error: null
        };
        const { props } = ref.current;
        ref.current = current;
        if (!props) forceUpdate(current);
      })
      .catch(error => {
        throw error; //
      });
  }

  const query = useMemoOperationDescriptor(gqlQuery, variables);

  const queryFetcher = useQueryFetcher();

  const { fetchPolicy, networkCacheConfig, ttl } = options;

  const { props, error, ...others } = queryFetcher.execute(
    environment,
    query,
    {
      networkCacheConfig,
      fetchPolicy:
        rehydrated && environment.isOnline() ? fetchPolicy : STORE_ONLY
    },
    (environment, query) => environment.retain(query.root, { ttl }) // TODO new directive
  );

  const current = {
    ...others,