Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tejas2008 committed Dec 17, 2024
1 parent bad782c commit 1d95cb4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,11 @@ export class AppSyncModelVisitor<
connectionInfo.targetName !== 'id'
) {
// Need to remove the field that is targetName
connectionInfo.targetNames.forEach(targetName => removeFieldFromModel(model, targetName));
// Don't remove the field if it is a primary key field
const primaryKeyFieldNames = getModelPrimaryKeyComponentFields(model).map(field => field.name);
connectionInfo.targetNames
.filter(targetName => !primaryKeyFieldNames.includes(targetName))
.forEach(targetName => removeFieldFromModel(model, targetName));
}
});
});
Expand Down

0 comments on commit 1d95cb4

Please sign in to comment.