airtable-plus icon indicating copy to clipboard operation
airtable-plus copied to clipboard

`create` doesn't support array results

Open vjpr opened this issue 5 years ago • 0 comments

create can take an array, which means its response can also be an array.

record._rawJson returns undefined if the result is an array.

const record = await base(tableName).create(data);
return complex? record : record._rawJson;

Workaround

Always use complex: true.

Fix

return complex ? record : _.castArray(record).map(r => r.rawJson)

Aside

Why is !complex the default?

vjpr avatar Apr 10 '20 00:04 vjpr