fix(select-tree): handle empty strict root results#220
Merged
Conversation
CodeWithDennis
force-pushed
the
fix/empty-strict-root-results
branch
from
July 16, 2026 07:06
255cff3 to
98a7262
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a production crash in the select tree view when strict null parent root nodes are enabled and the result set does not contain an entry for the configured root parent value.
In that situation,
buildTreeFromResults()tried to read$resultCache[$parent]['children']directly. When the category tree is empty, or when filtering leaves no valid root bucket,$resultCache[$parent]is not initialized. PHP then raises anUndefined array key ""warning, which Laravel converts into aViewExceptionwhile renderingresources/views/select-tree.blade.php.Changes
Why
The component should be able to render an empty tree without failing. An empty category, an empty query result, or a filtered tree with no root nodes are valid states for the field and should produce an empty option list.
Verification
php -l src/SelectTree.phpThe full Pest/PHPUnit suite was not run locally.