[Bug]: check shouldRevalidation before cancel a loader #12105
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.
Closes #12007
The normal behavior is:
fetcher1.load()
gets cancelled if afetcher2.action()
is called, then thefetcher1.load()
is called again because of revalidation.The problem (bug?) is that a cancelled loader would always get revalidated, which means that
fetcher1.load()
is called two times (even though the first execution is aborted, it could mean a double API fetch).Suggested behavior:
Check if a loader
shouldRevalidate
before it gets cancelled (because if not, we can just let it resolve).This PR is a draft, because this same solution conflicts with things like error-throwing and redirections (and it also breaks some other tests) and wanted to hear your takes on this problem.