File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
examples/solid/solid-start-streaming/src/routes Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 11import { Title } from '@solidjs/meta'
2+ import { queryOptions , useQuery } from '@tanstack/solid-query'
3+ import { Suspense } from 'solid-js'
4+
5+ const makeQueryOptions = ( key : string ) =>
6+ queryOptions ( {
7+ queryKey : [ 'e2e-test-query-integration' , key ] ,
8+ queryFn : async ( ) => {
9+ console . log ( 'fetching query data' )
10+ await new Promise < void > ( ( resolve ) => {
11+ setTimeout ( resolve , 500 )
12+ } )
13+ const result = 'data'
14+ console . log ( 'query data result' , result )
15+ return result
16+ } ,
17+ staleTime : Infinity ,
18+ } )
219
320export default function Home ( ) {
21+ const query = useQuery ( ( ) => makeQueryOptions ( 'useQuery' ) )
22+
423 return (
524 < main >
625 < Title > Solid Query v5</ Title >
@@ -12,6 +31,10 @@ export default function Home() {
1231 streaming support. Use the links in the top left to navigate between the
1332 various examples.
1433 </ p >
34+
35+ < Suspense >
36+ < div data-testid = "query-data" > { query . data ?? 'loading...' } </ div >
37+ </ Suspense >
1538 </ main >
1639 )
1740}
Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ export class QueryObserver<
8484 this . #client = client
8585 this . #selectError = null
8686 this . #currentThenable = pendingThenable ( )
87+ if ( ! this . options . experimental_prefetchInRender ) {
88+ this . #currentThenable. reject (
89+ new Error ( 'experimental_prefetchInRender feature flag is not enabled' ) ,
90+ )
91+ }
8792
8893 this . bindMethods ( )
8994 this . setOptions ( options )
You can’t perform that action at this time.
0 commit comments