You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a follow-up to #8120, there's another case where the component suspends indefinitely. This occurs consistently when the promise and suspense are colocated. Here's a failing test:
it.only('should throw error if the promise fails (colocate suspense and promise)',async()=>{constconsoleMock=vi.spyOn(console,'error').mockImplementation(()=>undefined)constkey=queryKey()letqueryCount=0functionMyComponent(){constquery=useQuery({queryKey: key,queryFn: async()=>{awaitsleep(1)if(++queryCount>1){// second time this query mounts, it should not throwreturn'data'}thrownewError('Error test')},retry: false,})constdata=React.use(query.promise)return<>{data}</>}functionPage(){return(<React.Suspensefallback="loading.."><MyComponent/></React.Suspense>)}constrendered=renderWithClient(queryClient,<ErrorBoundaryfallbackRender={(props)=>(<>errorboundary{' '}<buttononClick={()=>{props.resetErrorBoundary()}}>resetErrorBoundary</button></>)}><Page/></ErrorBoundary>,)awaitwaitFor(()=>rendered.getByText('loading..'))awaitwaitFor(()=>rendered.getByText('error boundary'))consoleMock.mockRestore()fireEvent.click(rendered.getByText('resetErrorBoundary'))awaitwaitFor(()=>rendered.getByText('loading..'))awaitwaitFor(()=>rendered.getByText('data'))expect(queryCount).toBe(2)})
Your minimal, reproducible example
Failing test above
Steps to reproduce
Run the test above
Expected behavior
The error boundary should trigger, but the component suspends indefinitely
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
OS: Windows 11
Browser: Chrome
Version: 129.0
Tanstack Query adapter
react-query
TanStack Query version
5.59.16
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
As a follow-up to #8120, there's another case where the component suspends indefinitely. This occurs consistently when the promise and suspense are colocated. Here's a failing test:
Your minimal, reproducible example
Failing test above
Steps to reproduce
Run the test above
Expected behavior
The error boundary should trigger, but the component suspends indefinitely
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
OS: Windows 11
Browser: Chrome
Version: 129.0
Tanstack Query adapter
react-query
TanStack Query version
5.59.16
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: