diff --git a/.changeset/solid-query-status-resource.md b/.changeset/solid-query-status-resource.md
new file mode 100644
index 00000000000..12a340a386f
--- /dev/null
+++ b/.changeset/solid-query-status-resource.md
@@ -0,0 +1,5 @@
+---
+"@tanstack/solid-query": patch
+---
+
+Start Solid query resources when status fields are read so curried `queryOptions` fetch on mount without requiring `data` access.
diff --git a/packages/query-devtools/src/__tests__/utils.test.ts b/packages/query-devtools/src/__tests__/utils.test.ts
index 511553e2bb8..f59199f3869 100644
--- a/packages/query-devtools/src/__tests__/utils.test.ts
+++ b/packages/query-devtools/src/__tests__/utils.test.ts
@@ -982,6 +982,7 @@ describe('Utils tests', () => {
describe('setupStyleSheet', () => {
afterEach(() => {
document.head.querySelector('#_goober')?.remove()
+ delete (window as Window & { __nonce__?: string }).__nonce__
})
it('should not insert any style tag when "nonce" is missing', () => {
@@ -1004,6 +1005,14 @@ describe('Utils tests', () => {
expect(styleTag?.tagName).toBe('STYLE')
})
+ it('should set "window.__nonce__" from the provided nonce', () => {
+ setupStyleSheet('test-nonce')
+
+ expect(
+ (window as Window & { __nonce__?: string }).__nonce__,
+ ).toBe('test-nonce')
+ })
+
it('should set the "nonce" attribute on the inserted style tag', () => {
setupStyleSheet('test-nonce')
diff --git a/packages/query-devtools/src/utils.tsx b/packages/query-devtools/src/utils.tsx
index 5306f2cf5f2..b09a2455d19 100644
--- a/packages/query-devtools/src/utils.tsx
+++ b/packages/query-devtools/src/utils.tsx
@@ -306,6 +306,7 @@ export const deleteNestedDataByPath = (
// Adds a nonce to the style tag if needed
export const setupStyleSheet = (nonce?: string, target?: ShadowRoot) => {
if (!nonce) return
+ ;(window as Window & { __nonce__?: string }).__nonce__ = nonce
const styleExists =
document.querySelector('#_goober') || target?.querySelector('#_goober')
diff --git a/packages/solid-query/src/__tests__/useQuery.test.tsx b/packages/solid-query/src/__tests__/useQuery.test.tsx
index 745a9ab1cc2..44b0346a403 100644
--- a/packages/solid-query/src/__tests__/useQuery.test.tsx
+++ b/packages/solid-query/src/__tests__/useQuery.test.tsx
@@ -30,6 +30,7 @@ import {
QueryClient,
QueryClientProvider,
keepPreviousData,
+ queryOptions,
useQuery,
} from '..'
import { Blink, mockOnlineManagerIsOnline, setActTimeout } from './utils'
@@ -244,6 +245,71 @@ describe('useQuery', () => {
expect(rendered.getByText('test')).toBeInTheDocument()
})
+ it('should fetch when a curried queryOptions result only reads status fields', async () => {
+ const key = queryKey()
+ const queryFn = vi.fn((slug: string) => `test-${slug}`)
+ const fetchQueryOptions = (slug: string) =>
+ queryOptions({
+ queryKey: [key, slug],
+ queryFn: () => queryFn(slug),
+ })
+
+ function Page() {
+ const options = fetchQueryOptions('slug')
+ const state = useQuery(() => options)
+
+ return (
+