EatTheBlocks Forum

Todo Dapp - Drizzle - step 16 has been fixed

Following a few discussions on the group chat, I have fixed step 16. To make it work, I also had

  • Initial attempts to make Todo.sol#getTasks() work by returning an array of Task struct failed because web3 cannot handle arrays of struct yet. Single struct are fine
  • As a result, changed Todo.sol#getTasks() to make it return a tuple of arrays (ids[], dates[], etc…) that is folded into an array of tasks on the frontend [{id: , date: , etc...}, {}, etc...]
  • string fields in Task struct were replaced by bytes32 fields because web3 couldn’t handle properly string arrays returned by Todo.sol#getTasks()
  • Added missing id for toggleDone() in frontend
  • Fixed typos in frontend (ToDo instead of Todo, and missing this.props when accessing drizzle object).
  • Dates display properly