Open manickam1999 opened 4 months ago
No, you are wrong. Example: HTTP request updates globally shared data. The first request was initiated and took 25 seconds to execute. After 10 seconds, the user navigates to another URL, causing a similar request (that updates the same data). This second request takes 14 seconds to execute, and the data is updated. After just 1 second it will be updated by the first request.
The first request had to be canceled on navigation (when the component is destroyed).
Issue:
prefer-takeuntil
Rule Should Not Trigger for HTTP RequestsDescription: The
prefer-takeuntil
rule currently triggers whensubscribe
is called within a component, requiring the use of thetakeUntil
-destroyed pattern. However, this rule should not be triggered for HTTP requests, since HTTP requests clean up themselves, such as the one shown below:Example Code:
Reason: For specific HTTP requests, especially those that are one-time operations and do not need to be unsubscribed from when the component is destroyed, enforcing the
takeUntil
pattern is unnecessary and adds unnecessary complexity to the code.Proposed Solution: Modify the
prefer-takeuntil
rule to allow exceptions for certain HTTP request patterns, such ashttp.patch
,http.post
,http.put
, etc. This could be controlled through additional rule options or by recognizing common HTTP request patterns that do not require unsubscription.Example Configuration: