Skip to content

fix(tree): trigger re-render when filter and onChange in Tree component#8386

Merged
melloware merged 1 commit intoprimefaces:masterfrom
kaylaa0:fix/issue-8381
Nov 12, 2025
Merged

fix(tree): trigger re-render when filter and onChange in Tree component#8386
melloware merged 1 commit intoprimefaces:masterfrom
kaylaa0:fix/issue-8381

Conversation

@kaylaa0
Copy link
Copy Markdown
Contributor

@kaylaa0 kaylaa0 commented Nov 12, 2025

Defect Fixes:

Fix #8381

Issue:

When the Tree component is configured with both the filter={true} prop and an onToggle callback, updates made to the tree nodes (e.g., changes to their expanded/collapsed state or content) are not reflected in the immediately subsequent render. The correct state only appears in the render cycle following that.

Solution:

  1. Introduced a new internal state variable, forceRender.
  2. The value of forceRender is toggled (set to its negative/opposite boolean value) whenever the tree's filter criteria change.
  3. This state change forces the component to re-render, ensuring the latest node data is displayed immediately.

Result / Testing:

  • Changes to the tree nodes' state (e.g., toggling a node) now render correctly and immediately in the same render cycle.
test_case.mp4

All specified cases were tested and are confirmed to be working correctly.

Comment thread components/lib/tree/Tree.js
@melloware melloware merged commit 72e3b0b into primefaces:master Nov 12, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tree: Node updates not immediately rendered when using filter + onToggle (v10.9.7 regression)

2 participants