Skip to content
Open
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
14 changes: 10 additions & 4 deletions packages/query-core/src/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,16 @@ export function hydrate(
// Note that we need to call these even when data was synchronously
// available, as we still need to set up the retryer
query
.fetch(undefined, {
// RSC transformed promises are not thenable
initialPromise: Promise.resolve(promise).then(deserializeData),
})
.fetch(
// Preserve the query's behavior (e.g. infiniteQueryBehavior) so
// that when the streamed promise resolves, the data gets processed
// through the correct pipeline instead of being stored raw.
query.options.behavior ? { behavior: query.options.behavior } : undefined,
{
// RSC transformed promises are not thenable
initialPromise: Promise.resolve(promise).then(deserializeData),
},
)
// Avoid unhandled promise rejections
.catch(noop)
}
Expand Down
Loading