-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
p-dropdown in angular 17 hangs loading for ever. #14407
Comments
We're unable to replicate your issue, if you are able to create a reproducer by using PrimeNG Issue Template or add details please edit this issue. This issue will be closed if no activities in 20 days. |
https://stackblitz.com/edit/github-4z4rkv?file=src%2Fapp%2Fapp.component.ts |
@JimmyBjorklund Please fix string in instead of
should be
|
@cetincakiroglu See similar issue #14320 |
That fixes the initial load state when it works, but in my case it do not even load the page and i need to kill the browser compleatly as it hang the entire page. |
I don't see any issue in the example. Could not replicate the mentioned behavior. Could you please guide me how to reproduce it? |
I have a similar issue, if I have a function returning my objects for the dropdown options. The browser is freezing because it recalls the method all the time in a loop. zone Version 0.14.4, e.g. [options]="getArray() | async " |
I also have this issue of the browser freezing upon template with I'm using:
This code works:import { Component } from '@angular/core';
import { DropdownModule } from 'primeng/dropdown';
@Component({
selector: 'app-test-p-dropdown',
standalone: true,
imports: [DropdownModule],
template: '<p-dropdown [options]="options"></p-dropdown>',
styles: '',
})
export class TestPDropdownComponent {
options = [];
} This code does NOT workNotice the only difference is the import { Component } from '@angular/core';
import { DropdownModule } from 'primeng/dropdown';
@Component({
selector: 'app-test-p-dropdown',
standalone: true,
imports: [DropdownModule],
template: '<p-dropdown [options]="options.slice()"></p-dropdown>',
styles: '',
})
export class TestPDropdownComponent {
options = [];
} |
@cetincakiroglu I tried to make the example as small as possible for you to be able to replicate the issue. Could you update the labels. |
Btw. notice that it is not the E.g. the following code also produces the error: import { Component } from '@angular/core';
import { DropdownModule } from 'primeng/dropdown';
@Component({
selector: 'app-test-p-dropdown',
standalone: true,
imports: [DropdownModule],
template: '<p-dropdown [options]="options()"></p-dropdown>',
styles: '',
})
export class TestPDropdownComponent {
options() {
return [];
}
} |
here it works https://stackblitz.com/edit/github-4z4rkv-mkxhp5?file=src%2Fapp%2Fapp.component.html |
Correct usage as below:
|
I can confirm that the issue i have is more or less the same if i have a private variable called devices and a property that return this.devices || [] then it hangs for ever but if i make the variable public then it works. Something is broken here....... |
@cetincakiroglu thanks for your reply. With this hint I managed to workaround. I still don't understand why the correct usage is to "not use a function call" in the template as in my first example For the issue with the For another situation that gave the same issue I found a solution with the new Angular signals. import { Component, Signal, computed } from '@angular/core';
import { DropdownModule } from 'primeng/dropdown';
@Component({
selector: 'app-test-p-dropdown',
standalone: true,
imports: [DropdownModule],
template: '<p-dropdown [options]="options()"></p-dropdown>',
styles: '',
})
export class TestPDropdownComponent {
options: Signal = computed(() => {
return [];
});
} Still I think the issue reported here is a bug and that the issue should be reopened. But that is up to you. Thank you for the reply. |
How can this be closed? If you need to dynamically create a list of items at runtime, @cetincakiroglu this is still an issue. |
@pscanlon1 your are right. it's a critical bug. Though it's not good practice to have functions as options, it's sometimes necessary, to use it especially with params. At the moment the dropdown is a critical component in primeng. |
It looks like _options in the angular 17 branch was changed from
to
|
+1 |
Could you please share a stackblitz example so we can identify the issue? |
@cetincakiroglu I have the same issue with slice. It seems like an incompatibility between Angular's A general guess, Test the
|
Describe the bug
I have a page with this code and its bin working fine in angular 16 but after the upgrade to 17 it hangs the load of the page for ever.
Environment
Reproducer
No response
Angular version
17.0.7
PrimeNG version
17.1.0
Build / Runtime
TypeScript
Language
ES5
Node version (for AoT issues node --version)
v20.10.0
Browser(s)
Edge Version 120.0.2210.77 (Official build) (64-bit)
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: