We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bad782c commit 1d95cb4Copy full SHA for 1d95cb4
packages/appsync-modelgen-plugin/src/visitors/appsync-visitor.ts
@@ -1184,7 +1184,11 @@ export class AppSyncModelVisitor<
1184
connectionInfo.targetName !== 'id'
1185
) {
1186
// Need to remove the field that is targetName
1187
- connectionInfo.targetNames.forEach(targetName => removeFieldFromModel(model, targetName));
+ // Don't remove the field if it is a primary key field
1188
+ const primaryKeyFieldNames = getModelPrimaryKeyComponentFields(model).map(field => field.name);
1189
+ connectionInfo.targetNames
1190
+ .filter(targetName => !primaryKeyFieldNames.includes(targetName))
1191
+ .forEach(targetName => removeFieldFromModel(model, targetName));
1192
}
1193
});
1194
0 commit comments