Skip to main content
Solved

To-do List example throws can not read primaryField on null

  • June 1, 2020
  • 1 reply
  • 11 views

I just cloned the to-do list example to get familiar with blocks and it starts with a can not read primaryField of null when compiled.

It’s a small fix with the code i found, this is just if anyone else finds it also for the airtable team to update their sample code.
Since there is no table selected in the beginning of the list table is null therefore need to add in a check for table present before calling table.primaryField.

const records = useRecords(doneField ? view : null, {fields: [table ? table.primaryField : null, doneField]});

{fields: [table ? table.primaryField : null, doneField]}); update this object!
Thank you!

Best answer by Emma_Yeap

Thanks for posting about this, @Rutvik_Patel! We’ll update the example.

edit: The example is now updated.

1 reply

Forum|alt.badge.img+11
  • Inspiring
  • 55 replies
  • Answer
  • June 1, 2020

Thanks for posting about this, @Rutvik_Patel! We’ll update the example.

edit: The example is now updated.