Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(react-query):fix-missing-isServer-import #7849

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

ryxxn
Copy link
Contributor

@ryxxn ryxxn commented Aug 4, 2024


This PR adds the missing import for the isServer variable in the app/get-query-client.ts file example in the official documentation.


Issue

The isServer variable is used in the getQueryClient function but is not imported, causing a reference error when the code is executed.

The issue is present in the documentation at:
https://tanstack.com/query/latest/docs/framework/react/guides/advanced-ssr


before:

// app/get-query-client.ts
import { QueryClient, defaultShouldDehydrateQuery } from '@tanstack/react-query'

// ...

export function getQueryClient() {
  if (isServer) { // -----> missing import
    // Server: always make a new query client
    return makeQueryClient()
  } else {
    // ...
  }
}

after

// app/get-query-client.ts
import {
  isServer, // <----- add import
  QueryClient,
  defaultShouldDehydrateQuery,
} from '@tanstack/react-query'

// ...

export function getQueryClient() {
  if (isServer) {
    // Server: always make a new query client
    return makeQueryClient()
  } else {
    // ...
  }
}

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Aug 4, 2024
Copy link

nx-cloud bot commented Aug 5, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 156d94e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

Copy link

pkg-pr-new bot commented Aug 5, 2024

commit: 156d94e

pnpm add https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@7849
pnpm add https://pkg.pr.new/@tanstack/angular-query-experimental@7849
pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-query@7849
pnpm add https://pkg.pr.new/@tanstack/query-async-storage-persister@7849
pnpm add https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@7849
pnpm add https://pkg.pr.new/@tanstack/query-core@7849
pnpm add https://pkg.pr.new/@tanstack/query-devtools@7849
pnpm add https://pkg.pr.new/@tanstack/query-persist-client-core@7849
pnpm add https://pkg.pr.new/@tanstack/query-sync-storage-persister@7849
pnpm add https://pkg.pr.new/@tanstack/react-query@7849
pnpm add https://pkg.pr.new/@tanstack/react-query-devtools@7849
pnpm add https://pkg.pr.new/@tanstack/react-query-next-experimental@7849
pnpm add https://pkg.pr.new/@tanstack/react-query-persist-client@7849
pnpm add https://pkg.pr.new/@tanstack/solid-query@7849
pnpm add https://pkg.pr.new/@tanstack/solid-query-devtools@7849
pnpm add https://pkg.pr.new/@tanstack/solid-query-persist-client@7849
pnpm add https://pkg.pr.new/@tanstack/svelte-query@7849
pnpm add https://pkg.pr.new/@tanstack/svelte-query-devtools@7849
pnpm add https://pkg.pr.new/@tanstack/svelte-query-persist-client@7849
pnpm add https://pkg.pr.new/@tanstack/vue-query@7849
pnpm add https://pkg.pr.new/@tanstack/vue-query-devtools@7849

Open in Stackblitz

More templates

@TkDodo TkDodo merged commit d14e006 into TanStack:main Aug 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants