Hello! I have two linked tables, let’s say Users and Events, and the Events table contains an Attendees column that links to Users. I want to add a new value to this column using the API. The code is quite simple:
But this overwrites the previous attendees. Can I just add one new value to the cell without overwriting the previous ones? I know I can read the previous values manually, add the new one and write the whole array back – but that’s a race condition waiting to happen, isn’t it? Is it possible that someone changes the value after I read the previous contents and before I write the new, augmented value?
It will not really affect the possibility of a race condition. You are still reading the previous value and adding the new one before writing the whole array back. This will not affect the fact that someone else could have updated the field in between the read and the write. At best, it will slightly decrease the time between the read and the write, but it is impossible to reduce that time to zero.
On the other hand, given how most Airtable bases are used, it is unlikely that this will be a problem in most situations. If this type of split second timing important, Airtable may not be the right platform.