rm-hull / rm-hull/maps

Fix issue with `idle` (Gemini code review comment)

Open
#791 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
17h 1m
Merged PRs (30d)
43

Description

high

In TanStack Query v5, the idle status has been removed. Disabled queries now start with a pending status. This change causes your fromReactQuery function to incorrectly return a "busy" state for disabled queries, which will likely result in a misleading UI (e.g., showing a spinner for a query that isn't running).

To fix this, you can differentiate between a truly pending (loading) query and a disabled one by using the isLoading flag, which is true only when a query is pending and fetching.

I recommend updating the function to accept isLoading and handle the disabled case separately, like this:

export function fromReactQuery(status: QueryStatus, isLoading: boolean): SearchState {
  // A disabled query in v5 has status 'pending' but isLoading is false.
  // This check restores the behavior of the old 'idle' status.
  if (status === "pending" && !isLoading) {
    return undefined;
  }

  switch (status) {
    case "error":
      return "error";
    case "pending":
      return "busy";
    case "success":
      return "ok";
  }
}

You will also need to update the call sites to pass this value. For example, in TracksForm.tsx:

const { status, isLoading, ... } = useGeoJSON(...);
const state = fromReactQuery(status, isLoading);

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Find the fromReactQuery function and its call sites, including TracksForm.tsx where useGeoJSON provides the query state. Read how status and isLoading are currently obtained, then update the disabled-query handling so pending but non-loading queries are not reported as busy. Verify the affected UI no longer shows a loading state for disabled queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.