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

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!

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

edit: The example is now updated.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.