ngxtension / ngxtension-platform

Utilities for Angular
https://ngxtension.netlify.app/
MIT License
531 stars 77 forks source link

Suggestion: add `extendedEffect` that gets the previous return value passed, similar to `extendedComputed` #438

Open ptandler opened 1 week ago

ptandler commented 1 week ago

In Vue.js, the watch function gets the new and old watched value passed as arguments, which is really helpful in case the differences matter, or when I want to release the previous allocated resource and need the previous resource handle.

The effect in Angular works a little different and does not provide help here, so what about adding a extendedEffect that works similar to extendedComputed (or to Vue's watch) which is evaluated eagerly and gets the previous value as argument?

See also https://stackoverflow.com/questions/76200595/possible-to-access-the-old-value-in-angular-16s-effect-function-similar-to-vuejs-watch