Преглед изворни кода

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

Fixes #1377
thewebkit пре 4 година
родитељ
комит
b6dd5f4543
1 измењених фајлова са 4 додато и 1 уклоњено
  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
         // For custom fields on the Address entity, we also extend the OrderAddress
         // type (which is used to store address snapshots on Orders)
         // type (which is used to store address snapshots on Orders)
         if (schema.getType('OrderAddress')) {
         if (schema.getType('OrderAddress')) {