timbrandin/autoform-slingshot

Previous file array item clears out while adding new item.

Opened this issue · 2 comments

I have following schema for my autoform.

uploads: {
        type: Array,
        label: 'Upload Files',
        optional: true
    },
    'uploads.$': {
        type: Object,
        label: 'Add file'
    },
    'uploads.$.fileType': {
        type: String,
        label: 'Select the type of file',
        autoform: {
            type: 'selectize',
            options: function () {
                return [
                    {label: "label1", value: "label1"},
                    {label: "label2", value: "label2"},
                    {label: "label3", value: "label3"}
                ];
            }
        }
    },
    'uploads.$.fileName': {
        type: String,
        label: 'Enter file name (Optional)'
    },
    'uploads.$.pictureUrl': {
      type: String,
      label: 'Upload a Photo',
      autoform: {
            type: 'slingshotFileUpload',
            afFieldInput:{
              slingshotdirective: 'uploadImages'
            }
        }
    }

But whehever, I click on adding new element in my autoform, the file upload label from of previous element gets change to upload from remove... then I had to again go to that upper element and choose file second time to upload it successfully.

Did you ever find a solution to this? I'm facing the same problem.

I fixed this issue in a cousin of this package with this commit.
literalsands@209b514

It was a consequence of the way the array is being stored and the fact that autoform doesn't preserve ids within arrays.
Meteor-Community-Packages/meteor-autoform#1146