Graphql 继电器重新蚀刻不';不显示结果
我正在尝试创建一个实时搜索结果组件(lazy load one)。它第一次可以完美地工作,但是refetch不会更新数据。我在Graphql 继电器重新蚀刻不';不显示结果,graphql,relay,react-relay,relaymodern,Graphql,Relay,React Relay,Relaymodern,我正在尝试创建一个实时搜索结果组件(lazy load one)。它第一次可以完美地工作,但是refetch不会更新数据。我在网络选项卡中看到请求和响应!因此,它确实获得了数据,但没有将其提供给组件 知道为什么吗 import React, { Component } from 'react'; import { createRefetchContainer, graphql, } from 'react-relay'; import ProfileShow from './P
网络
选项卡中看到请求和响应!因此,它确实获得了数据,但没有将其提供给组件
知道为什么吗
import React, { Component } from 'react';
import {
createRefetchContainer,
graphql,
} from 'react-relay';
import ProfileShow from './ProfileShow';
class ProfileList extends Component {
render() {
console.log("rendering....", this.props)
return (
<div className="row">
<input type="text" onClick={this._loadMe.bind(this)} />
{this.props.persons.map((person) => {
return (
<div className="col-md-3">
<ProfileShow person={person} />
</div>
);
})}
</div>
);
}
_loadMe(e) {
const refetchVariables = fragmentVariables => ({
queryStr: e.target.value,
});
this.props.relay.refetch(refetchVariables, null, (...data) => {
console.log(data)
});
}
}
const FragmentContainer = createRefetchContainer(
ProfileList,
{
persons: graphql.experimental`
fragment ProfileList_persons on Person @relay(plural: true) {
fullname
number
email
pic
}
`
},
graphql.experimental`
query ProfileListRefetchQuery($queryStr: String!) {
talentList(query: $queryStr) {
...ProfileList_persons
}
}
`,
);
export default FragmentContainer;
import React,{Component}来自'React';
进口{
createRefetchContainer,
graphql,
}来自“反应继电器”;
从“/ProfileShow”导入ProfileShow;
类ProfileList扩展了组件{
render(){
console.log(“呈现…”,this.props)
返回(
{this.props.persons.map((person)=>{
返回(
);
})}
);
}
_加载我(e){
常量refetchVariables=fragmentVariables=>({
queryStr:e.target.value,
});
this.props.relay.refetch(refetch变量,null,(…数据)=>{
console.log(数据)
});
}
}
const FragmentContainer=createRefetchContainer(
档案列表,
{
人员:graphql`
片段档案列表\u Person@relay上的人员(复数:true){
全名
数
电子邮件
照片
}
`
},
实验图形`
查询ProfileListRefetchQuery($queryStr:String!){
人才列表(查询:$queryStr){
…个人资料列表
}
}
`,
);
导出默认碎片容器;
所以我没有足够的时间来处理这个问题!相反,我使用了阿波罗客户端,这是完美的!我也有同样的问题你是阿波罗的客户!它的方式更容易使用,并有更多有用的功能!事实上,我做到了,它在各个方面都很优秀。谢谢