Browse Source

fix(core): Fix OrderAddress type AddressCustomFields error (#1394)

Fixes #1377
thewebkit 4 years ago
parent
commit
b6dd5f4543
1 changed files with 4 additions and 1 deletions
  1. 4 1
      packages/core/src/api/config/graphql-custom-fields.ts

+ 4 - 1
packages/core/src/api/config/graphql-custom-fields.ts

@@ -185,7 +185,10 @@ export function addGraphQLCustomFields(
         }
     }
 
-    if (customFieldConfig.Address?.length) {
+    const publicAddressFields = customFieldConfig.Address?.filter(
+        config => !config.internal && (publicOnly === true ? config.public !== false : true),
+    );
+    if (customFieldConfig.Address?.length && publicAddressFields?.length) {
         // For custom fields on the Address entity, we also extend the OrderAddress
         // type (which is used to store address snapshots on Orders)
         if (schema.getType('OrderAddress')) {