close
Skip to content

[2.x] fix(admin): correct tree array construction in GeneralSearchSource#4373

Merged
imorland merged 1 commit into2.xfrom
im/fix-admin-search-tree-map
Feb 21, 2026
Merged

[2.x] fix(admin): correct tree array construction in GeneralSearchSource#4373
imorland merged 1 commit into2.xfrom
im/fix-admin-search-tree-map

Conversation

@imorland
Copy link
Copy Markdown
Member

@imorland imorland commented Feb 21, 2026

Array.prototype.push() returns the new length (a number), not the array. Using it as the tree argument caused result.tree.map() to throw "e.tree.map is not a function" when rendering admin search results for any setting with a tree property.

Replace .map(extractText).push(label) with [...map(extractText), label] to return an array as expected.

**Fixes #4372 **

Changes proposed in this pull request:

Reviewers should focus on:

Screenshot

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)

Array.prototype.push() returns the new length (a number), not the array.
Using it as the tree argument caused result.tree.map() to throw
"e.tree.map is not a function" when rendering admin search results for
any setting with a tree property.

Replace `.map(extractText).push(label)` with `[...map(extractText), label]`
to return an array as expected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imorland imorland added this to the 2.0.0-beta.7 milestone Feb 21, 2026
@imorland imorland requested a review from a team as a code owner February 21, 2026 12:20
@imorland imorland merged commit 6dfe10f into 2.x Feb 21, 2026
37 of 60 checks passed
@imorland imorland deleted the im/fix-admin-search-tree-map branch February 21, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.x] Admin settings search crash

1 participant