Form submission keeps running

If I click "submit" when the form is empty, it keeps running without throwing an error.
I'm doing "Bulk Upsert using Primary Key". Array of records to update is created by a transformer.
The transformer looks like:

var initData = { "month" : {{ month.value }}, "year" : {{ year.value }}, "employee_email" : {{companyEmail.value}} }
var listViewData = {{}}
var id = { "id" : {{['0']}} }
const result = => Object.assign({}, item, initData, id))
return result

Hey @piusjin!

Could you share the value of your transformer when the form is empty as well as the object?

I'm wondering if listViewData is populating correctly and whether or not something like {{ yourTransformer.value ?? [] }} will work in your upsert query.

Hi @Kabirdas ,
I get the following error message:
message:"Cannot read properties of undefined (reading 'map')"

I see, that would make sense if {{ }} is still undefined at the moment you run the query. One way that you might be able to work around that in the transformer itself is to use optional chaining:

const result = listViewData?.map(item => Object.assign({}, item, initData, id)) ?? SOME_DEFAULT_VALUE

That will check to see if listViewData is defined before attempting to map over its value and if it's not just return some default value instead.

Does that work?