Improve the grid responsiveness by caching and reusing the last… #872
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The getGridColumnStyle and getGridRowStyle methods from GridsterRenderer service that are used in HTML through ngStyle directive are not optimized and in some cases is crashing the app and browser by continuously calling these two methods over and over, and reason of this is that these methods are returning a new objects every time and Angular understands that there is a change and this process never stops.
To improve this behavior I added a cache for the last calculated style and reuse the last style if not changed.
This issue was discovered in a hybrid Angular project with AngularJs and Angular 14 and the problem occurred only on downgraded gridster components, while on components not downgraded was working as expected. I suspect that this is caused by different ways of handling change detections and rendering between AngularJs and Angular 14.