فهرست منبع

Fixed Board does not load, by disabling Custom Fields sorting.

Thanks to marcungeschikts, olivierlambert and xet7 !

Fixes #3540
Lauri Ojansivu 4 سال پیش
والد
کامیت
d57eb6a2fc
1فایلهای تغییر یافته به همراه25 افزوده شده و 7 حذف شده
  1. 25 7
      models/cards.js

+ 25 - 7
models/cards.js

@@ -702,14 +702,16 @@ Cards.helpers({
     const definitions = CustomFields.find({
     const definitions = CustomFields.find({
       boardIds: { $in: [this.boardId] },
       boardIds: { $in: [this.boardId] },
     }).fetch();
     }).fetch();
-
+    if (definitions === undefined) {
+      return {};
+    }
     // match right definition to each field
     // match right definition to each field
     if (!this.customFields) return [];
     if (!this.customFields) return [];
     const ret = this.customFields.map(customField => {
     const ret = this.customFields.map(customField => {
       const definition = definitions.find(definition => {
       const definition = definitions.find(definition => {
         return definition._id === customField._id;
         return definition._id === customField._id;
       });
       });
-      if (!definition) {
+      if (definition === undefined) {
         return {};
         return {};
       }
       }
       //search for "True Value" which is for DropDowns other then the Value (which is the id)
       //search for "True Value" which is for DropDowns other then the Value (which is the id)
@@ -731,12 +733,28 @@ Cards.helpers({
         definition,
         definition,
       };
       };
     });
     });
-    ret.sort(
-      (a, b) =>
-        a.definition.name !== undefined &&
-        b.definition.name !== undefined &&
+    /*
+    Sometimes sorting custom fields returns a is undefined or
+    something else is undefined, so only trying does it work,
+    and catching errors.
+      => Custom Fields sorting disabled, because could not
+        get with working with any error handling logic,
+        board did have errors with many variations of below changes.
+
+    if (definition === undefined) {
+      return {};
+    }
+    if (definition.name === undefined) {
+      return {};
+    }
+    try {
+      ret.sort((a, b) =>
         a.definition.name.localeCompare(b.definition.name),
         a.definition.name.localeCompare(b.definition.name),
-    );
+      );
+    } catch (error) {
+      console.error(error);
+    }
+    */
     return ret;
     return ret;
   },
   },