Fix duplicated search criteria in Knowledge Base tree view (#24090) - #25657
Open
aymericcucherousset wants to merge 2 commits into
Open
aymericcucherousset wants to merge 2 commits into
aymericcucherousset wants to merge 2 commits into
Conversation
Member
|
Please follow the pull request template and be sure to link any relevant issues using closing keywords. I think there is at least one issue currently open about this. |
Code Review by QodoView medium (3)🟠 **Medium** 1.
|
This branch has not been deployed
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.
Checklist before requesting a review
Description
In the Knowledge Base Browse (tree) view, the search form displayed two criteria on first load instead of one, and each search added another one. The List view was not affected.
Cause
ajax/treebrowse.phpandTreeBrowse::showBrowseView()add a hidden category criterion flagged asvirtual. This criterion was also passed toQueryBuilder::showGenericSearch(), which rendered it as a regular search field.Since the virtual criterion was not stored in the session, the form displayed an additional default criterion. Submitting the search saved it as a regular criterion, causing the duplication to increase with each search.
Fix
QueryBuilder::showGenericSearch()now filters out virtual criteria before rendering the search form.Tests
QueryBuilderTest): verifies that regular criteria are rendered correctly, virtual criteria are excluded, and the "add rule" counter reflects only visible criteria.Knowbase/tree_browse.spec.ts): verifies that the Browse view displays only one criterion, that submitting a search does not duplicate it or submit virtual criteria, and that category filtering continues to work.Screenshots