Skip to content

Commit 7cf5923

Browse files
authored
fix(react-query-next-experimental): replace deprecated 'isServer' with 'environmentManager.isServer()' (#10857)
1 parent 2faff25 commit 7cf5923

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/react-query-next-experimental': patch
3+
---
4+
5+
fix(react-query-next-experimental): replace deprecated 'isServer' with 'environmentManager.isServer()'

packages/react-query-next-experimental/src/HydrationStreamProvider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { isServer } from '@tanstack/react-query'
3+
import { environmentManager } from '@tanstack/react-query'
44
import { useServerInsertedHTML } from 'next/navigation'
55
import * as React from 'react'
66
import { htmlEscapeJsonString } from './htmlescape'
@@ -106,7 +106,7 @@ export function createHydrationStreamProvider<TShape>() {
106106

107107
// <server stuff>
108108
const [stream] = React.useState<Array<TShape>>(() => {
109-
if (!isServer) {
109+
if (!environmentManager.isServer()) {
110110
return {
111111
push() {
112112
// no-op on the client
@@ -154,7 +154,7 @@ export function createHydrationStreamProvider<TShape>() {
154154
// the initial render so children have access to the data immediately
155155
// This is important to avoid the client suspending during the initial render
156156
// if the data has not yet been hydrated.
157-
if (!isServer) {
157+
if (!environmentManager.isServer()) {
158158
const win = window as any
159159
if (!win[id]?.initialized) {
160160
// Client: consume cache:

packages/react-query-next-experimental/src/ReactQueryStreamedHydration.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import {
44
defaultShouldDehydrateQuery,
55
dehydrate,
6+
environmentManager,
67
hydrate,
7-
isServer,
88
useQueryClient,
99
} from '@tanstack/react-query'
1010
import * as React from 'react'
@@ -42,7 +42,7 @@ export function ReactQueryStreamedHydration(props: {
4242
const [trackedKeys] = React.useState(() => new Set<string>())
4343

4444
// <server only>
45-
if (isServer) {
45+
if (environmentManager.isServer()) {
4646
// Do we need to care about unsubscribing? I don't think so to be honest
4747
queryClient.getQueryCache().subscribe((event) => {
4848
switch (event.type) {

0 commit comments

Comments
 (0)