reactjs - this.props.relay.setVariables() doesnt fetch new results (but change variable as well) -
i can't figure out i'm doing wrong, can't make work refetching new range via change variable.
here part of relay container code (on initial works , fetch first 5 results):
export const account = relay.createcontainer(_account, { initialvariables: { activities: 5 }, fragments: { account: () => relay.ql` fragment on nodeinterface { id ... on member { activities(first: $activities) { totalcount edges { node { id } } } } } ` }, });
here part of react component changes relay variable:
export class _account extends react.component { constructor(props) { super(props); this.state = { activities: 5 }; } loadmoreactivities(e) { e.preventdefault(); this.setstate((state,props) => { const next = state.activities + 5; this.props.relay.setvariables({ activities: next }); return { activities: next } }); } render() { return ( <div> <div>{ this.state.activities.tostring() } - { this.props.relay.variables.activities.tostring() }</div> <profileactivitylist activities={this.props.account.activities} loadmore={this.loadmoreactivities.bind(this)} /> } </div> ); } }
i figure out wrong. pageinfo
data important pagination. add pageinfo
query , works excepted.
Comments
Post a Comment