Skip to content
Source
Sign inSign up
TanStack/query

Latest published 5.105.1 still emits an unhandled CancelledError for a paused refetch #12479

ClosedCaliLuke(GitHub profile, opens in a new tab) opened this issue 1 comment

Affected release

@tanstack/query-core@5.105.1, the latest published release checked on November 1, 2026. Reproduced with Node.js 26.12.1.

Reproduction

In an empty directory run npm install @tanstack/query-core@5.105.1, save this as repro.mjs, and run node repro.mjs:

import { QueryClient, onlineManager } from '@tanstack/query-core';

const errors = [];
const record = error => errors.push(error);
process.on('unhandledRejection', record);
const client = new QueryClient();
const queryKey = ['example'];

try {
  await client.fetchQuery({ queryKey, queryFn: async () => 'value' });
  onlineManager.setOnline(false);
  await client.refetchQueries({ queryKey }, { throwOnError: true });
  console.log('Fetch status:', client.getQueryState(queryKey).fetchStatus);
  client.clear();
  await new Promise(resolve => setTimeout(resolve, 0));
  console.log('Unhandled rejections:', errors.map(error => error.message));
} finally {
  onlineManager.setOnline(true);
  client.clear();
  process.off('unhandledRejection', record);
}

Actual output:

Fetch status: paused
Unhandled rejections: [ 'CancelledError' ]

Expected behavior

Cancelling a detached paused fetch should not emit an unhandled rejection after the public refetchQueries promise has already resolved. This report does not request changing the public promise's existing paused-query behavior.

#12441 is closed, and the .catch(noop) fix in #12442 merged on November 1 at 12:49 UTC. Version 5.105.1 was published at 10:08 UTC, before that merge, and the isolated reproduction above still fails on that published version. This is a follow-up for the continuing failure in the latest released package; the merged fix is relevant history, not a claim that it failed.

  1. it’s just not released yet

  2. TkDodo closed this

Sign in to join this conversation.