JavaScript

JavaScript

Made by DeepSource

Found impure pipes JS-0575

Performance
Major
Autofix

Impure pipes should be avoided because they are invoked on each change-detection cycle. Impure pipes can’t leverage caching, instance re-use and simple tests.

An impure pipe executes every time irrespective of whether the source value has changed or not. This can lead to performance degradation; it is one of the reasons pipes are not preferred for filtering data.

Bad Practice

@Pipe({
    name: 'test',
    pure: false
})
class Test {}

Recommended

@Pipe({
    name: 'test',
    pure: true
})
class Test {}
@Pipe({
    name: 'test'
})
class Test {}