Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

bug [upstream]: queryCollection does not refetch in non-windowed environments (Chrome extension, vscode extension)

クローズ
#1,250 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
typescript
領域
frontend

調査の方向性

QueryObserver が作成される queryCollectionOptions から始め、TanStack Query の upstream issue で説明されているウィンドウ非依存の動作を確認してください。globalThis.window が未定義の状態で再現し、Chrome または VS Code のような環境で設定された refetch 間隔が observer.refetch() を呼び出すことを検証してください。

索引モデルが issue の本文から書いたものです。

説明

wontfix
  • I've validated the bug against the latest version of DB packages

Describe the bug
An upstream issue in Tanstack Query prevents Tanstack DB from operating correctly in environments missing

To Reproduce
Steps to reproduce the behavior:

Create any collection in an environment where globalThis.window is undefined

Expected behavior
Refetches occur

Additional context
(From @KyleAMathews)

Root cause: TanStack Query's QueryObserver.#updateRefetchInterval() has a hard guard:

if (isServer ...) { return }

where isServer = typeof window === 'undefined' 'Deno' in globalThis. In a VS Code extension (Node.js), window is undefined so the refetch interval timer is never created.

TanStack Query's own docs: The recommended non-browser setup (e.g., React Native guide) uses focusManager.setFocused() and onlineManager.setOnline(). But those don't help here — the isServer guard fires before the focusManager.isFocused() check, so it blocks entirely.

Upstream status: This is acknowledged as a limitation in TanStack/query Discussion #4018. Maintainer TkDodo said the isServer check should be decoupled from setInterval availability, but no fix has landed — still present on main.

Given this, the proper fix should be at the QueryClient configuration level where queryCollectionOptions creates the QueryObserver. Since isServer is a module-level constant we can import from @tanstack/query-core, the cleanest approach is: when isServer && refetchInterval is configured, set refetchIntervalInBackground: true and manage a simple interval ourselves using observer.refetch() — the public API TanStack Query provides for exactly this purpose.

主要言語
TypeScript
スター
3.9k
フォーク
272
平均マージ
1日 1時間
マージ済み PR(30日)
212

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/db のほかの issue

TanStack/db の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。