diff --git a/examples/solid/solid-start-streaming/src/components/post-viewer.tsx b/examples/solid/solid-start-streaming/src/components/post-viewer.tsx index 03aab139d7..7fb11f62e5 100644 --- a/examples/solid/solid-start-streaming/src/components/post-viewer.tsx +++ b/examples/solid/solid-start-streaming/src/components/post-viewer.tsx @@ -17,14 +17,16 @@ export const PostViewer: Component = (props) => { const [simulateError, setSimulateError] = createSignal(props.simulateError) const [postId, setPostId] = createSignal(1) + const shouldSimulateError = () => + simulateError() || (simulateError() !== false && postId() === 5) + const query = useQuery(() => ({ - queryKey: ['posts', postId()], + queryKey: ['posts', postId(), props.sleep, shouldSimulateError()], queryFn: () => fetchPost({ postId: postId(), sleep: props.sleep, - simulateError: - simulateError() || (simulateError() !== false && postId() === 5), + simulateError: shouldSimulateError(), }), deferStream: props.deferStream, throwOnError: true, diff --git a/examples/solid/solid-start-streaming/src/components/user-info.tsx b/examples/solid/solid-start-streaming/src/components/user-info.tsx index 73bb7e602c..70261a175d 100644 --- a/examples/solid/solid-start-streaming/src/components/user-info.tsx +++ b/examples/solid/solid-start-streaming/src/components/user-info.tsx @@ -14,8 +14,9 @@ export interface UserInfoProps { } export const userInfoQueryOpts = (props?: UserInfoProps) => ({ - queryKey: ['user'], - queryFn: () => fetchUser(props), + queryKey: ['user', props?.sleep, props?.simulateError], + queryFn: () => + fetchUser({ sleep: props?.sleep, simulateError: props?.simulateError }), deferStream: props?.deferStream, staleTime: props?.staleTime, gcTime: props?.gcTime,