Skip to content

SearchExpressionResolver: @id always uses visitTree ? #5466

@melloware

Description

@melloware

Original PrimeFaces Discussion and Analysis: https://github.com/orgs/primefaces/discussions/2350

Brief Overview

PF13- used to have its own @id resolver that always walked the component tree and was working. In PF14 that was removed to rely on JSF 2.3+ ID resolver which behaves differently. We are doing render="@root:@id(growl)" inside a Datatable row.

Code

The question is I don't see how it can ever get to the branch where it walks the component instead of using visitTree

if (isHintSet(searchKeywordContext.getSearchExpressionContext(), SearchExpressionHint.SKIP_VIRTUAL_COMPONENTS)) {
// Avoid visit tree because in this case we need real component instances.
// This means components inside UIData will not be scanned.
findWithId(facesContext, id, current, searchKeywordContext.getCallback());
} else {
current.visitTree(VisitContext.createVisitContext(facesContext, null, searchKeywordContext.getSearchExpressionContext().getVisitHints()),

I have grepped the code base and I never see SearchExpressionHint.SKIP_VIRTUAL_COMPONENTS actually ever set and the note even mentions..

// Avoid visit tree because in this case we need real component instances.
// This means components inside UIData will not be scanned.

Question

So how does the branch that doesn't use visitTree ever get executed? Right now I had to inject the old PF @id resolver to fix this issue and have the code work like it did before using the PF findWithId type code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions