What are you trying to do? (please be as specific as possible and include relevant screenshots, code snippets)
I’m using a upload component that when used will
1.- create a row in one of my tables, one of the cells will be a random generated uuid.
2.- upload the file to one of my supabase buckets, using the id or name of the file as the path (previously filled in the row)
3.- update the value of a state so I can see if the path was filled correctly.
Issues:
1.- no matter what I do, in the first interaction which is creating the row it duplicates it, I’ve traid setting the upload from zero in a completely different page and it always creates a duplicate row, I do have the following filter on all the interactions from this field: ($state.upload.files.length > 0) I’ve also tried not updating all queries after the row creation, the duplication still happens.
2.- when I upload the file to the bucker I select the las .file_name on the table as the path, which was created in the previous step using the following formula: $queries.filesTable.data[0]?.file_name
For some reason it always gets the previous upload which would be the third cell in the table due to the duplication, or the second if that problem didn’t exist, in other words, when this step fetches the table is does not use the last updated information. However if I give the same value ($queries.filesTable.data[0]?.file_name) to a state variable, it automatically updates, so plasmic is reading the correct information, only in the interactions is ready the second to last.
this step is after the row was already crated and refreshed so it should fetch the data correctly.
what I’ve tried:
using the following formulas: $queries.filesTable.data[$queries.filesTable.data-1]?.file_name $queries.filesTable.data[$queries.filesTable.data.length-1]?.file_name using a “Refresh data” interaction after creating the row and before uploading the file to the bucket. does not work It will still use the second to last.
What are the reproduction steps? -
-(duplication) creating a new upload field with a limit of files of 1. Setting up a “use integration” interaction with supabase, create row and any of the refresh queries.
-(wrong fetch issue) the step before as the first interactions block, the second block a “use integration > Upload file > when files length is greater than one.
setup: file path: $queries.filesTable.data[0].file_name or the other formulas I shared above.
content: $state.upload.files[$state.upload.files.length - 1]?.contents
Type: $state.upload.files[$state.upload.files.length - 1]?.type
(here the file path will not use the last row in the table it will use the next to that one, 3rd)
i’ve also recorded the issue in case It is a little confusing: IMG_4505.MOV - Google Drive
Thanks.