Skip to content

Commit

Permalink
fix(utils): transformInputsToPrisma reset data after disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
RabahZeineddine committed Mar 3, 2023
1 parent 548c17e commit 054a6c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/prisma/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export function transformInputsToPrisma(
const connect = data[key].map((id) => ({ id }));

// Clear the relation key
data[key] = {};

const disconnect = lodash.difference(cloneOldData[key], data[key]);

data[key] = {};

// disconnect relation only if it needs to.
if (disconnect.length > 0)
data[key]['disconnect'] = disconnect.map((id) => ({ id }));
Expand Down

0 comments on commit 054a6c9

Please sign in to comment.