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

To help you get started, we’ve selected a few react-relay 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 berty / berty / client / react-native / app / graphql / queries / TestLogBackgroundWarn.js View on Github external
fetch: async (variables = {}) =>
    (await fetchQuery(context.environment, query, variables))
      .TestLogBackgroundWarn,
})
github magma / magma / symphony / app / fbcnms-projects / inventory / app / components / configure / ServiceEndpointDefinitionTable.js View on Github external
async getEquipmentTypes(): Promise> {
    const response = await fetchQuery(RelayEnvironment, equipmentTypesQuery);
    return response.equipmentTypes.edges
      .map(edge => edge.node)
      .filter(Boolean)
      .sort((typ1, typ2) => sortLexicographically(typ1.name, typ2.name));
  }
github Bastiani / bastiani-blog / components / pages / ListPosts.tsx View on Github external
ListPosts.getInitialProps = async () => {
  const variables = {};
  if (initEnvironment && listPostsQuery) {
    const { environment, relaySSR } = initEnvironment();

    await fetchQuery(environment, listPostsQuery, variables);
    const relayData = await relaySSR.getCache();

    return {
      variables,
      relayData
    };
  }
  return {
    variables
  };
};
github berty / berty / client / react-native / app / graphql / queries / ConfigPublic.js View on Github external
fetch: async variables =>
    (await fetchQuery(
      context.environment,
      query,
      merge([defaultVariables, variables])
    )).ConfigPublic,
})
github episodeyang / ml_logger / ml-dash-client / src / Charts / ParameterRow.js View on Github external
function fetchChartConfig(path) {
  let id = toGlobalId("File", path);
  return fetchQuery(modernEnvironment, graphql`
      query ParameterRowChartConfigQuery($id: ID!) {
          node (id: $id) { id ...on File { yaml } }
      }`, {id});
}
github morrys / react-relay-offline / src / runtime / fetchQuery.ts View on Github external
async function fetchQuery(...args) {
  const [environment] = args;

  if (!environment.isRehydrated()) {
    await environment.hydrate();
  }

  return relayFetchQuery(...args);
}
github berty / berty / client / react-native / app / graphql / queries / EventList.js View on Github external
fetch: async variables =>
    fetchQuery(
      context.environment,
      query,
      merge([defaultVariables, variables])
    ),
})
github robrichard / relay-modern-isomorphic-example / js / renderServer.js View on Github external
export default async function(req, res, next) {
  const environment = getRelayEnvironment();
  const data = await fetchQuery(environment, rootQuery, variables);
  const renderedComponent = renderToString(
    
      
    
  );


  res.send(nunjucks.render('index.html', {
    renderedComponent: renderedComponent,
    records: JSON.stringify(environment.getStore().getSource()),
  }));
}
github Bastiani / bastiani-blog / components / pages / Post.tsx View on Github external
Post.getInitialProps = async ({ query: queryParams }: any) => {
  const variables = { slug: queryParams.slug };
  if (initEnvironment && postQuery) {
    const { environment, relaySSR } = initEnvironment();

    await fetchQuery(environment, postQuery, variables);
    const relayData = await relaySSR.getCache();

    return {
      variables,
      relayData
    };
  }
  return {
    variables
  };
};
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / relay / environment.js View on Github external
export const fetchQuery = (query, args) => FQ(environment, query, args);