Closed JYisus closed 5 years ago
Hello @JYisus,
Thanks for raising this issue. Does the render function check that the contract is initialized, and its data is fetched? See this example for how to check the preconditions: drizzle-react-components
If the render function is guarded by checks for initialization and data fetched and the issue remains, could you share a sample repo so we could reproduce the issue?
Thanks in advance!
Hi @cds-amal , I solved it restarting the server, i don't know what was wrong, but now it's working. Thank you for the help!
When I call a function that returns multiple values, the value that the object object of Drizzle takes is Null instead of the vector with the elements that I need. This is the Solidity code of that function:
function getRequest(uint _id) public view returns (address, uint) {
return (userRequest[msg.sender][_id].user, userRequest[msg.sender][_id].resource);
}
And this is how I call it:
// In the componentDidMount()
//...
const dataKey = contract.methods['getRequest'].cacheCall(this.props.idReq);
this.setState({ dataKey});
//... // In the render()
const { ControlAcceso } = this.props.drizzleState.contracts;
const request = ControlAcceso.getRequest[this.state.dataKey];
console.log(request && request)
The result of this console.log is: