airtable-go
airtable-go copied to clipboard
Fix list unmarshal bug
I've discovered a bug in list where some values from previous rows lingered, ie:
Row ID | Col A | Col B |
---|---|---|
ROW 1 | Val A1 | Val B1 |
ROW 2 | Val B2 |
So list returned Val A1 for both row 1 and row 2.
I suspect the json output from the airtable api omits empty strings, and with the key missing the reused tempsRecordsHolder
is not being updated.
To avoid that, I moved its initialisation inside the recursive function recursivelyListRecordsAtOffset
.
That fixed my problems.
Edit: I've just read the comments above the code I've modified again and it made me doubt myself. Have to give this a second thought.
Edit2: I've just ran a second round of tests and the bug is definitely there and this patch definitely fixes it. Will try to come up with a repro.