Deleting a linked card blocked the parent board to load #3540

This commit is contained in:
Martin Filser 2021-02-08 21:07:25 +01:00
parent 76e9e2076e
commit 116aae0828

View file

@ -702,7 +702,7 @@ Cards.helpers({
const definitions = CustomFields.find({ const definitions = CustomFields.find({
boardIds: { $in: [this.boardId] }, boardIds: { $in: [this.boardId] },
}).fetch(); }).fetch();
if (definitions === undefined) { if (!definitions) {
return {}; return {};
} }
// match right definition to each field // match right definition to each field
@ -711,7 +711,7 @@ Cards.helpers({
const definition = definitions.find(definition => { const definition = definitions.find(definition => {
return definition._id === customField._id; return definition._id === customField._id;
}); });
if (definition === undefined) { if (!definition) {
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)
@ -733,28 +733,15 @@ Cards.helpers({
definition, definition,
}; };
}); });
/* // at linked cards custom fields definition is not found
Sometimes sorting custom fields returns a is undefined or ret.sort(
something else is undefined, so only trying does it work, (a, b) =>
and catching errors. a.definition !== undefined &&
=> Custom Fields sorting disabled, because could not b.definition !== undefined &&
get with working with any error handling logic, a.definition.name !== undefined &&
board did have errors with many variations of below changes. b.definition.name !== undefined &&
a.definition.name.localeCompare(b.definition.name)
if (definition === undefined) { );
return {};
}
if (definition.name === undefined) {
return {};
}
try {
ret.sort((a, b) =>
a.definition.name.localeCompare(b.definition.name),
);
} catch (error) {
console.error(error);
}
*/
return ret; return ret;
}, },