Skip to content

Cached query doesn't abort uncached resulting in race conditions #498

Open

Description

@SQReder

If query started with cached parameters it doesn't abort running uncached query

const cachedQuery = createQuery({ 
  handler() {
    const ac = new AbortController();

    onAbort(() => {
      ac.abort("early aborted");
    });

    ...
  }
})

concurrency(cachedQuery, { strategy: "TAKE_LATEST" });
cache(cachedQuery, { staleAfter: "1m" });


cachedQuery.start('1st'); // long query that will be cached
/// wait for complete ...
cachedQuery.start('2nd'); // long query that should be aborted
// start cached query before 2nd resolved
cachedQuery.start('1st'); // completes almost immediately but doesnt abort 2nd

Reproduce https://github.com/SQReder/farfetched-cache-issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions