1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

Replace get first element from filter with find

This commit is contained in:
Alexander Skvortsov
2020-09-12 16:31:32 -04:00
committed by Franz Liedke
parent 0e715a8c40
commit 537e2690e8

View File

@@ -39,7 +39,7 @@ export default class SelectDropdown extends Dropdown {
} }
getButtonContent(children) { getButtonContent(children) {
const activeChild = children.filter(isActive)[0]; const activeChild = children.find(isActive);
let label = (activeChild && activeChild.children) || this.attrs.defaultLabel; let label = (activeChild && activeChild.children) || this.attrs.defaultLabel;
if (label instanceof Array) label = label[0]; if (label instanceof Array) label = label[0];