react-csv-importer icon indicating copy to clipboard operation
react-csv-importer copied to clipboard

Dynamically generated ImportFields are not cleaned. No option to rerender Importer

Open rs-thestable opened this issue 3 years ago • 1 comments
trafficstars

Hey, I have a usecase where user can select from multiple ImporterField configurations using select input. After selection an array with fields for mapping is created: eg.

table1 = ['a','b'] 
table2 = ['c', 'd']

const [importColumns, setImportColumns] = useState([])

importColumns is set using select input

inside Importer it should be dynamically rendered like this

<Importer {...props} >
              {importColumns.map((field, i) => (
                <ImporterField key={i} name={field} label={field} />
              ))}
</Importer>

Problem is that when user changes select, Importer will concatenate all columns config and it will have all like ['a', 'b', 'c', 'd'] instead of rendering only those that are selected. There is no option to re-render Importer after selection is made. Only option is to refresh browser and re-render entire app.

rs-thestable avatar Aug 29 '22 23:08 rs-thestable

Oh, that's a good catch, thanks. I'll add this to my to-do list (fixes have been really slow for me the last while but I am working through the pile).

unframework avatar Aug 30 '22 07:08 unframework

Hi Rafal, this should be now fixed in v0.8.0.

unframework avatar Dec 29 '22 21:12 unframework