Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
'@tanstack/react-query-next-experimental': patch
---

fix(react-query-next-experimental): replace deprecated 'isServer' with 'environmentManager.isServer()'
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
'use client'

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

// <server stuff>
const [stream] = React.useState<Array<TShape>>(() => {
if (!isServer) {
if (!environmentManager.isServer()) {
return {
push() {
// no-op on the client
Expand DownExpand Up@@ -154,7 +154,7 @@ export function createHydrationStreamProvider<TShape>() {
// the initial render so children have access to the data immediately
// This is important to avoid the client suspending during the initial render
// if the data has not yet been hydrated.
if (!isServer) {
if (!environmentManager.isServer()) {
const win = window as any
if (!win[id]?.initialized) {
// Client: consume cache:
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,8 +3,8 @@
import {
defaultShouldDehydrateQuery,
dehydrate,
environmentManager,
hydrate,
isServer,
useQueryClient,
} from '@tanstack/react-query'
import * as React from 'react'
Expand DownExpand Up@@ -42,7 +42,7 @@ export function ReactQueryStreamedHydration(props: {
const [trackedKeys] = React.useState(() => new Set<string>())

// <server only>
if (isServer) {
if (environmentManager.isServer()) {
// Do we need to care about unsubscribing? I don't think so to be honest
queryClient.getQueryCache().subscribe((event) => {
switch (event.type) {
Expand Down
Loading