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

Dropdown: selectedItem template not displayed on the first change of form control #14283

Closed
tsinevik opened this issue Dec 6, 2023 · 3 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@tsinevik
Copy link
Contributor

tsinevik commented Dec 6, 2023

Describe the bug

If Dropdown has selectedItem template that uses the context variable and this dropdown is connected to reactive form there might be an issue when dynamically setting the value for the first time (for example in ngOnInit or in Input setter calling control.setValue). Dropdown displayed shrunk and there's no value, but on click it returns to normal display. Seems like some rerender issue during change detection.

image

Environment

Any environment

Reproducer

https://stackblitz.com/edit/qgxlcn?file=src%2Fapp%2Fdemo%2Fdropdown-template-demo.ts,src%2Fapp%2Fdemo%2Fdropdown-template-demo.html

Angular version

17.0.0

PrimeNG version

17.0.0-rc.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.18.0

Browser(s)

No response

Steps to reproduce the behavior

https://stackblitz.com/edit/qgxlcn?file=src%2Fapp%2Fdemo%2Fdropdown-template-demo.ts,src%2Fapp%2Fdemo%2Fdropdown-template-demo.html

  1. Provide selectedItem template to Dropdown and use context variable to display the value
  2. Create form control with empty value, connect it to dropdown component
  3. At ngOnInit set some value to the control
  4. Dropdown displayed incorrectly with strange height and without value

Expected behavior

Dropdown should display value correctly

@tsinevik tsinevik added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 6, 2023
@jacqueslareau
Copy link

Still present in 17.0.0

@jakob-bebop
Copy link

Still present in 17.0.0 and Angular 17.0.6

@jakob-bebop
Copy link

I guess this is a duplicate #14241, which appears to be fixed in the upcoming version...

Is there an eta for 17.1.0?

@tsinevik tsinevik closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

3 participants