File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -157,14 +157,13 @@ function updateHasManyThrough (
157
157
return PivotModel . find ( { where : { [ leftFKName ] : leftPKValue } } )
158
158
. then ( models => {
159
159
const existingIds = models . map ( model => model [ rightFKName ] )
160
- const newIds = rightFKValues . map ( id => id )
161
- const idsToDelete = _ . difference ( existingIds , newIds )
160
+ const idsToDelete = _ . difference ( existingIds , rightFKValues )
162
161
return PivotModel . destroyAll ( {
163
162
[ leftFKName ] : leftPKValue ,
164
163
[ rightFKName ] : { inq : idsToDelete }
165
164
} )
166
165
. then ( ( ) => {
167
- const idsToAdd = _ . difference ( newIds , existingIds )
166
+ const idsToAdd = _ . difference ( rightFKValues , existingIds )
168
167
return PivotModel . create (
169
168
idsToAdd . map ( id => ( {
170
169
[ leftFKName ] : leftPKValue ,
You can’t perform that action at this time.
0 commit comments