You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for sharing this pipe. It's very useful.
In my testing I've found that if you use .bind(this) as the fn input for the pipe, the function value is treated as a new function each time because .bind() is called creating a new wrapper function during each change detection cycle. As a result, the bound method is called on every change detection cycle, not just when inputs change. This defeats the memoizing of the pipe.
Although it's still a valid technique for fixing the 'this' of the fn function, I feel the README.md file should point out the pitfall of doing it that way when you've provided a better alternative. (the context parameter). Well done on the context parameter by the way, as I've seen articles by other prolific Angular devs where they have struggled to find an elegant solution.
The text was updated successfully, but these errors were encountered:
@jcairney Thanks for Your investigation! 👍
You are right regarding bind method and new function as an output. I will update README regarding that pitfall.
Hi, thanks for sharing this pipe. It's very useful.
In my testing I've found that if you use .bind(this) as the fn input for the pipe, the function value is treated as a new function each time because .bind() is called creating a new wrapper function during each change detection cycle. As a result, the bound method is called on every change detection cycle, not just when inputs change. This defeats the memoizing of the pipe.
Although it's still a valid technique for fixing the 'this' of the fn function, I feel the README.md file should point out the pitfall of doing it that way when you've provided a better alternative. (the context parameter). Well done on the context parameter by the way, as I've seen articles by other prolific Angular devs where they have struggled to find an elegant solution.
The text was updated successfully, but these errors were encountered: