Skip to content
Source
Sign inSign up
TanStack/query

fix(solid-query): show streamed chunks as they arrive instead of holding the first one 🤖🤖🤖 #12670

Opentydavid5(GitHub profile, opens in a new tab)wants to merge 1 commit intosolid-query-v6-pre fromrefs/pull/12670/headopened View on GitHub

Showing 3 changed files with 129 additions and 4 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/pre/streamed-chunks-hold-fix.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/solid-query': patch
+---
+​
+Fix `useQuery` holding the first streamed chunk until the stream ends: when a cache write lands while a fetch is in flight, serve the fresh cache data instead of waiting on the in-flight fetch promise. Fixes #12665.
101 additions and 1 deletionpackages/solid-query/src/__tests__/useQuery-semantics.test.tsxModified
View file
@@ -8,7 +8,7 @@
import { fireEvent } from '@solidjs/testing-library'
import { Errored, Loading, createSignal } from 'solid-js'
import { createKey, sleep } from '@tanstack/query-test-utils'
-import { QueryCache, QueryClient, useQuery } from '..'
+import { QueryCache, QueryClient, experimental_streamedQuery, useQuery } from '..'
import { renderWithClient } from './utils'
​
describe('useQuery 2.0 read semantics', () => {
@@ -102,6 +102,106 @@
expect(rendered.getByText('data2')).toBeInTheDocument()
​
+ it('shows each streamed chunk as it arrives instead of holding the first one', async () => {
+ const key = createKey()