ezeikel
11/11/2021, 3:32 PMconnect
? This doesn't seem to work:
location: {
connect: existingLocation
? {
id: existingLocation?.id,
}
: {},
create: location,
},
ezeikel
11/11/2021, 3:33 PMezeikel
11/11/2021, 3:34 PMlocations: {
connect:
existingLocations?.map(location => ({
id: location.id,
})) || [],
create: locations,
},
ezeikel
11/11/2021, 3:36 PMconnect
seems happy with an empty array but not empty object?ezeikel
11/11/2021, 3:43 PMundefined
instead of the empty object seemed to do the trick:
location: {
connect: existingLocation
? {
id: existingLocation?.id,
}
: undefined,
create: location,
},
Ryan
11/12/2021, 5:55 AMundefined
will be ideal in this case as well as for multiple values in connect
.ezeikel
11/12/2021, 11:18 AM