Skip to content

Commit

Permalink
rethrow next build error
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed Jan 26, 2025
1 parent b7d9755 commit 9d3b116
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions integrations/react-next-15/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { headers } from 'next/headers'
import React from 'react'
import { HydrationBoundary, dehydrate } from '@tanstack/react-query'
import { Temporal } from '@js-temporal/polyfill'
import { ClientComponent } from './client-component'
import { makeQueryClient } from './make-query-client'
import { queryExampleAction } from './_action'

const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

export default function Home() {
const queryClient = makeQueryClient()

void queryClient.prefetchQuery({
queryClient.prefetchQuery({
queryKey: ['data'],
queryFn: async () => {
const { count } = await (
await fetch('http://localhost:3000/count')
await fetch('http://localhost:3000/count', {
headers: await headers(),
})
).json()

return {
Expand Down
3 changes: 3 additions & 0 deletions packages/query-core/src/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ function dehydrateQuery(
queryHash: query.queryHash,
...(query.state.status === 'pending' && {
promise: query.promise?.then(serializeData).catch((error) => {
if ('digest' in error && error.digest === 'DYNAMIC_SERVER_USAGE') {
return Promise.reject(error)
}
if (process.env.NODE_ENV !== 'production') {
console.error(
`A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`,
Expand Down

0 comments on commit 9d3b116

Please sign in to comment.