primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.6k stars 4.62k forks source link

p-tree: Unselectable children when no key given in TreeNode #16819

Open SuRaMoN opened 2 days ago

SuRaMoN commented 2 days ago

Describe the bug

Caused by: https://github.com/primefaces/primeng/issues/16430

This fix causes nodes to be unselectable when nodes do not have a key.

example: https://stackblitz.com/edit/github-fos6jj-ljajyw?file=src%2Fapp%2Fapp.component.ts

Screen recording (i'm clicking the nodes, but they dont get selected): 388913003-cb4aa37f-b965-4b5e-a426-dad8d400683a

If you remove the keys sicne this fix selection does not work, with keys, it does work. 388913472-d8cb6566-a116-40ce-ae02-af0aaec45111

Reason is that since this fix we are cloning nodes: 388913235-09252381-05b9-4bc4-b067-1a019e8129af

But without keys we do a full contents comparison that always fails: 388913954-9f8c10fe-93ba-4386-ad77-70b320eb2795

Environment

https://stackblitz.com/edit/github-fos6jj-ljajyw?file=src%2Fapp%2Fapp.component.ts

Reproducer

https://stackblitz.com/edit/github-fos6jj-ljajyw?file=src%2Fapp%2Fapp.component.ts

Angular version

17.3.6

PrimeNG version

17.18.11

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.20.3

Browser(s)

No response

Steps to reproduce the behavior

Create a p-tree with checkboxes and TreeNodes without key Click on a checkbox of the tree https://stackblitz.com/edit/github-fos6jj-ljajyw?file=src%2Fapp%2Fapp.component.ts

Screen recording (i'm clicking the nodes, but they dont get selected): 388913003-cb4aa37f-b965-4b5e-a426-dad8d400683a

Expected behavior

The treenodes should be selectable even when they have no key as was the case before https://github.com/primefaces/primeng/issues/16430 was merged

github-actions[bot] commented 2 days ago

Due to PrimeNG team's busy roadmap, this issue is available for anyone to work on. Make sure to reference this issue in your pull request. :sparkles: Thank you for your contribution! :sparkles: