在graphql中,每次更新“数据”时对“加载”工作都做出反应吗?

在graphql中,每次更新“数据”时都执行“加载”工作吗?

现在,即使数据发生变化,第一次加载为true时还是下次再次为false时

const {loading,error,data,refetch,called } = useQuery(GET_COOKIES,{

    context: {
      headers: {"x-request-shop-id": props.currentStore ? props.currentStore.id : ""}},skip: !props.currentStore.id
  });
w476226477 回答:在graphql中,每次更新“数据”时对“加载”工作都做出反应吗?

来自docs

  

useQuery挂钩的结果对象通过networkStatus属性提供有关查询状态的详细信息。为了利用这些信息,我们需要将notifyOnNetworkStatusChange选项设置为true,以便我们的查询组件在进行重新获取时重新呈现

const {loading,error,data,refetch,called,networkStatus } = useQuery(GET_COOKIES,{

    context: {
      headers: {"x-request-shop-id": props.currentStore ? props.currentStore.id : ""}},skip: !props.currentStore.id,notifyOnNetworkStatusChange: true,});

  if (networkStatus === 4) return 'Refetching!';

您可以在source

中找到所有值
本文链接:https://www.f2er.com/3165069.html

大家都在问