We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using this as per the docs does not seem to work for my simple component using @apollo-client.
When running the story, the useQuery hook returns:
{ error: undefined, loading: true, data: undefined }
then it returns:
{ error: undefined, loading: false, data: undefined }
It does not return the mock I provided in my story:
story.tsx
import React from 'react' import { MockedProvider } from "@apollo/client/testing"; import LatestSells from '~/components/SalesPage/LatestSells' import { LATEST_SELL_SIGNALS } from '~/common/queries' export default { title: 'Sales page/latest sells', } const mocks = [ { request: { query: LATEST_SELL_SIGNALS, variables: {}, }, result: { data: { dog: { name: "Douglas" } } } } ] export const latest_sells = () => { return ( <MockedProvider mocks={mocks} addTypename={false}> <LatestSells /> </MockedProvider> ) }
I made my component as simple as possible to troubleshoot, but it doesn't work even when simplified down to the smallest possible react component.
component:
import React from 'react' import { useQuery } from '@apollo/client' import { LATEST_SELL_SIGNALS } from '~/common/queries' const LatestSells = () => { const { loading, error, data } = useQuery(LATEST_SELL_SIGNALS) console.log(loading, error, data) return null } export default LatestSells
Even with the simplest possible setup, this does not work.
Lastly here is my query:
import { gql } from 'apollo-boost' export const LATEST_SELL_SIGNALS = gql` query { latestSellSignalsList(orderBy: createdAt_DESC, first: 10) { items { name ticker boughtAt soldAt } } } `
I've doubled checked that the query console logs correctly and the same in both the story and the actual component.
versions: "@apollo/client": "^3.2.1", "storybook-addon-apollo-client": "^3.0.0",
P.S.
My component works fine on localhost and production, so the query etc. is definitely valid and normally called without issues.
The text was updated successfully, but these errors were encountered:
@MarkLyck what's your config for the Storybook Apollo Client Decorator look like in preview.js?
Sorry, something went wrong.
@MarkLyck closing since you haven't responded in almost 2 months.
In case anyone is encountering this, more to be found here : apollographql/apollo-client#7081 (comment)
No branches or pull requests
using this as per the docs does not seem to work for my simple component using @apollo-client.
When running the story, the useQuery hook returns:
then it returns:
It does not return the mock I provided in my story:
story.tsx
I made my component as simple as possible to troubleshoot, but it doesn't work even when simplified down to the smallest possible react component.
component:
Even with the simplest possible setup, this does not work.
Lastly here is my query:
I've doubled checked that the query console logs correctly and the same in both the story and the actual component.
versions:
"@apollo/client": "^3.2.1",
"storybook-addon-apollo-client": "^3.0.0",
P.S.
My component works fine on localhost and production, so the query etc. is definitely valid and normally called without issues.
The text was updated successfully, but these errors were encountered: