Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TreeNode: data is no longer generic #13183

Closed
kyjus25 opened this issue Jun 12, 2023 · 11 comments
Closed

TreeNode: data is no longer generic #13183

kyjus25 opened this issue Jun 12, 2023 · 11 comments
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@kyjus25
Copy link
Contributor

kyjus25 commented Jun 12, 2023

Describe the bug

The data attribute of TreeNode is now type any, which breaks the previous implementation of passing in a generic <T> value for data.
https://github.com/primefaces/primeng/blob/master/src/app/components/api/treenode.ts

The TreeNode would now probably have to be defined as something like TreeNode & { data?: T }, which is not ideal.

Screenshot from 2023-06-12 12-37-07

Here is what it used to be:
https://github.com/primefaces/primeng/blob/14.2.3/src/app/components/api/treenode.ts

Environment

Angular 16
PrimeNG 16

Reproducer

No response

Angular version

16.0.0

PrimeNG version

16.0.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

TreeNode should accept a generic data type instead of any

@kyjus25 kyjus25 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 12, 2023
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jun 13, 2023
@thetric
Copy link

thetric commented Jun 13, 2023

Broken in commit d3b00fc.

I was quite surprised of this breaking change in the public API because virtually no breaking changes was documented

@olegkap
Copy link

olegkap commented Jun 13, 2023

There is similar breaking change in cascade select control where now you can only bind any[] and not specific type as before.
I will work on example case later today but just wanted to give heads up since it might be related

@psarno
Copy link

psarno commented Jun 13, 2023

Confirmed, had to switch all of ours to the non-generic version to get it to compile.

@cetincakiroglu cetincakiroglu added this to the 16.0.1 milestone Jun 14, 2023
@bhalperin
Copy link

👏

@ficifor
Copy link

ficifor commented Jun 21, 2023

The data attribute is still type any, the generic value is not being passed on.

@gerbermichi
Copy link

gerbermichi commented Jun 26, 2023

The bug still exists in version 16.0.2.

@bhalperin
Copy link

bhalperin commented Jun 26, 2023

The bug still exists in version 16.0.2.

@gerbermichi does it fail in compile time? My experience is that compilation failed in v16.0.1 but passed successfully in v16.0.2.

@gerbermichi
Copy link

It doesn't compile.

https://github.com/primefaces/primeng/blob/master/src/app/components/api/treenode.ts

export interface TreeNode<T = any> {
    /**
     * Label of the node.
     */
    label?: string;
    /**
     * Data represented by the node.
     */
    data?: any;

data should be T not any.

@bhalperin
Copy link

It doesn't compile.

https://github.com/primefaces/primeng/blob/master/src/app/components/api/treenode.ts

export interface TreeNode<T = any> {
    /**
     * Label of the node.
     */
    label?: string;
    /**
     * Data represented by the node.
     */
    data?: any;

data should be T not any.

My app compiles and seems to behave as expected. But you are right, should be data?: T;

@tlinford
Copy link

Also can't compile after updating. could this be reopened?

@cetincakiroglu cetincakiroglu modified the milestones: 16.0.1, 16.0.3 Jul 10, 2023
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 10, 2023
@bhalperin
Copy link

👍

@cetincakiroglu cetincakiroglu removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 26, 2023
steve3d pushed a commit to steve3d/primeng that referenced this issue Aug 28, 2023
mertsincan pushed a commit that referenced this issue Aug 29, 2023
* feat: Add custom style class to p-table/p-dataview/p-treeview

* fix(primeng/p-button): spinner style not working propely

Fixes #13148.

* Fixed #13183 - Make TreeNode generic

* Fix: Icon list visibility

* fix(primeng/p-menu): render html via `DomSanitizer`

Fixes #13128.

* fix(primeng/p-button): not working `loadingIcon` property, update loadingdoc example

Fixes #13098.

* fix: update angular version restriction

* fix(primeng/p-confirmDialog): not updated style in runtime

Fixes #13155.

* Fix #13129 - FileUpload | File limit does not fire error

* Fix #13201 - OverlayPanel: Incorrect position when inside of dialog in 16.0.0 (did not happen in rc2)

* Fix - Surface color list

* fix #13124

---------

Co-authored-by: Egor Volvachev <axe.onegaimy@gmail.com>
Co-authored-by: Çetin <69278826+cetincakiroglu@users.noreply.github.com>
Co-authored-by: gucal <gucalaliriza@outlook.com>
Co-authored-by: Olivier Barais <olivieR.barais@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

9 participants