Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-2025-04-14· OpenAIHugging Face LMArena Human Preference 140K

Would useSuspenseQuery hook from react-query have ever return isFetched value as false?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Qwenqwen3-235b-a22b-no-thinking’s answer.
  1. User

    Would useSuspenseQuery hook from react-query have ever return isFetched value as false?

  2. Assistant

    Great question! Let's clarify how the useSuspenseQuery hook from React Query (now called TanStack Query) works, especially regarding the isFetched value.

    Key Points

    • useSuspenseQuery is a special hook that enables React Suspense for data fetching.
    • When using useSuspenseQuery, the component will suspend rendering until the data is fetched (or an error occurs).
    • The hook does not return any loading state (isLoading, isFetching, etc.) because the component is suspended during loading.

    About isFetched

    • isFetched is a boolean that indicates whether the query has been successfully fetched at least once.
    • In the context of useSuspenseQuery, the hook will only return when the data is available (i.e., after fetching is complete).
    • Therefore, isFetched will always be true when the hook returns, because the component would not render until the data is fetched.

    Example

    const { data, isFetched } = useSuspenseQuery(['todos'], fetchTodos);
    // At this point, isFetched is always true
    

    Why?

    • If the data is not yet fetched, the hook will throw a Promise, suspending the component.
    • Only after the data is fetched (or an error occurs), the component will resume rendering, and the hook will return the result.
    • So, isFetched will never be false when using useSuspenseQuery.

    Summary Table

    HookCan isFetched be false?
    useQueryYes
    useSuspenseQueryNo

    References


    In summary:

    useSuspenseQuery will never return isFetched as false. It will always be true when the hook returns, because the component is suspended until the data is fetched.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.