-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Parent Issue #30249 ### Proposed Changes * Change singal approach ### The problem This computed signal caused the error: ```ts $filteredSuggestions = computed(() => { const classes = this.$classes(); const query = this.$query(); if (!query) { return classes; } return classes.filter((item) => item.includes(query)); }); filterClasses({ query }: AutoCompleteCompleteEvent): void { this.$query.set(query); } ``` The signals functionality in PrimeNg doesn't works very well. In the previous signal, `$filteredSuggestions` doesn't trigger a change if the classes or query are the same as the current state. This is desirable. However, PrimeNg [waits](https://github.com/primefaces/primeng/blob/d6c7ffcfc5cb9a8ed355399ddae276c279836ccf/src/app/components/autocomplete/autocomplete.ts#L541) for a change in the `suggestions` input after the `completeMethod` is called to turn off the loading. This is why the loading indicator remains active but never deactivates. To address this, we manually forced a change in `$filteredSuggestions` and used `[...filteredClasses]` to create a new array. ```ts filterClasses({ query }: AutoCompleteCompleteEvent): void { const classes = this.$classes(); const filteredClasses = query ? classes.filter((item) => item.includes(query)) : classes; this.$filteredSuggestions.set([...filteredClasses]); } ``` ### Checklist - [x] Tests - [x] Translations - [x] Security Implications Contemplated (add notes if applicable) ### Screenshots https://github.com/user-attachments/assets/5a199569-9192-4acb-89bd-3fb6530aefce
- Loading branch information
Showing
7 changed files
with
78 additions
and
206 deletions.
There are no files selected for viewing
12 changes: 6 additions & 6 deletions
12
...plate-builder/components/add-style-classes-dialog/add-style-classes-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.