How to use the react-relay-offline.fetchQuery function in react-relay-offline

To help you get started, we’ve selected a few react-relay-offline 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 / offline-examples / relay / nextjs / relay / withData.tsx View on Github external
composedInitialProps = await ComposedComponent.getInitialProps(ctx);
    }
    if (!isServer) {
      return {
        ...composedInitialProps,
        environment: null,
      };
    }

    let queryProps = {};
    let queryRecords = {};
    const environment = initEnvironment();

    const {query, variables} = options;
    if (query) {
      queryProps = await fetchQuery(environment, query, variables);
      queryRecords = environment
        .getStore()
        .getSource()
        .toJSON();
    }
    return {
      ...composedInitialProps,
      ...queryProps,
      queryRecords,
      environment,
    };
  };