signal property

QueryCancelToken get signal

The cancel token for this fetch (TanStack Query: the AbortSignal).

Reading it marks the fetch as cancellable: from then on, losing the last observer or a cancelQueries cancels the token and the query function is expected to stop. A function that never reads it is left to finish.

The first read is what counts; reading it again changes nothing and returns the same token. Each retry gets a new context, so an attempt that never touches the token is as uncancellable as a first try that did not.

Implementation

QueryCancelToken get signal {
  if (!_signalConsumed) {
    _signalConsumed = true;
    _onSignalRead?.call();
  }
  return _signal;
}