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

p-cascadeSelect options: not change after new data in array of options #14698

Closed
AlexKuturkin opened this issue Feb 2, 2024 · 5 comments · Fixed by #15169
Closed

p-cascadeSelect options: not change after new data in array of options #14698

AlexKuturkin opened this issue Feb 2, 2024 · 5 comments · Fixed by #15169
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@AlexKuturkin
Copy link

AlexKuturkin commented Feb 2, 2024

Describe the bug

Hello everyone!

Earlier p-cascadeSelect options change after data was changed.
Also changed html, so in dropdown were new values.
This behavior was work in version "primeng": "15.4.15-lts",
example in stackblitz

Now, in version "primeng": "~17.3.2", this not working, unfortunately.
Any suggestions?

Thank you

Environment

angular app

Reproducer

https://stackblitz.com/edit/1pszed?file=src%2Fapp%2Fdemo%2Fcascade-select-basic-demo.html,package.json

Angular version

17.0.9

PrimeNG version

17.3.2

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.10.0

Browser(s)

Chrome 121.0.6167.86

Steps to reproduce the behavior

No response

Expected behavior

No response

@AlexKuturkin AlexKuturkin added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 2, 2024
@mehmetcetin01140 mehmetcetin01140 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 Feb 5, 2024
@fridolin-koch
Copy link

Having the same issue after upgrading from 16.x to 17.9.0

I'm not yet sure I totally the whole signals concept, but as far as I understand it:

processedOptions = computed(() => {
return this.createProcessedOptions(this.options || []);
});

Will only be called once. this.options needs to be a signal as well, otherwise it is never updated

Ref: https://angular.io/guide/signals#computed-signals

As a workaround I just re-render the cascade select after changing the options

@AlexKuturkin
Copy link
Author

As a workaround I just re-render the cascade select after changing the option

Hello!
Can you show how you did this, please.

@fridolin-koch
Copy link

Just use ngIf to toggle the element when you change the data

e.g. https://stackblitz.com/edit/clx9ov-7xf8sh

@cetincakiroglu cetincakiroglu added this to the 17.12.0 milestone Mar 8, 2024
@cetincakiroglu
Copy link
Contributor

Hi,

I've just clicked the button and options are updated https://stackblitz.com/edit/1pszed-tuskv8?file=src%2Fapp%2Fdemo%2Fcascade-select-basic-demo.html,src%2Fapp%2Fdemo%2Fcascade-select-basic-demo.ts

Could you please tell us how to reproduce the issue?

@cetincakiroglu cetincakiroglu added Resolution: Needs More Information More information about the issue is needed to find a correct solution and removed Type: Bug Issue contains a bug related to a specific component. Something about the component is not working labels Mar 19, 2024
@cetincakiroglu cetincakiroglu modified the milestones: 17.12.0, 17.13.0 Mar 19, 2024
@fridolin-koch
Copy link

Hi,

I've just clicked the button and options are updated https://stackblitz.com/edit/1pszed-tuskv8?file=src%2Fapp%2Fdemo%2Fcascade-select-basic-demo.html,src%2Fapp%2Fdemo%2Fcascade-select-basic-demo.ts

Could you please tell us how to reproduce the issue?

@cetincakiroglu The code you linked uses 15.4.15-lts which works fine. It also worked fine in 16.0.2

Here you can find the bug reproduction with 17.9.0 https://stackblitz.com/edit/clx9ov

The bug can also reproduced with 17.11.0 https://stackblitz.com/edit/clx9ov-rqfmhu

mehmetcetin01140 added a commit that referenced this issue Mar 26, 2024
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Resolution: Needs More Information More information about the issue is needed to find a correct solution labels Mar 29, 2024
cetincakiroglu added a commit that referenced this issue Mar 29, 2024
Fixed #14698 - p-cascadeSelect | options: not change after new data i…
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

Successfully merging a pull request may close this issue.

4 participants