Accessing FileUpload[] items by index
#155
AlMighty-Ymir
started this conversation in
General
Replies: 1 comment 4 replies
-
And some :) 🙏
I see your point. The first one may still have the same issue (e.g. some concurrent update), if I understand correctly. The latte seems the most robust. WDYT? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @ignatz ,
A penny for your thoughts:
When defining a column as an array of files like:
The API returns an array of
FileUpload[]objects. Accessing them works through:`${recordApiBasePath}/${apiName}/${recordId}/file/${columnName}``${recordApiBasePath}/${apiName}/${recordId}/files/${columnName}/${index}`Here the
indexcomes from the file’s position in the array.The problem I ran into: if I update the files array locally before persisting back to the record, the original indexes may shift, so the “correct” index for each file can get lost. That means I either need to reconstruct the array carefully, or find another way to consistently map file → URL.
Would it make sense for the API response to:
Curious what you think is the cleanest approach here.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions