Open wcardosodev opened 11 months ago
I have a use case where I need to call a query, but one of the variables to the query relies on an async atom. I can't seem to find a good way to achieve this at the moment. Is this currently possible? I.e
export const [playerAtom] = atomsWithQuery(async get => { const playerId = get(playerIdAtom); const playerTeams = get(playerTeamsAtom); const selectedPlayerMatches = await get(selectedPlayerMatchAtom); return { query: playerQuery, variables: { playerId: +playerId!, teamIds, matchIds, }, }; });
Which gives me an error, I think due to the potential of the playerAtom returning a promise: https://www.apollographql.com/docs/react/errors/#%7B"version"%3A"3.8.5"%2C"message"%3A71%2C"args"%3A%5B%5D%7D
playerAtom
Hey William, How are you doing? Do you have a reproduction?
I have a use case where I need to call a query, but one of the variables to the query relies on an async atom. I can't seem to find a good way to achieve this at the moment. Is this currently possible? I.e
Which gives me an error, I think due to the potential of the
playerAtom
returning a promise: https://www.apollographql.com/docs/react/errors/#%7B"version"%3A"3.8.5"%2C"message"%3A71%2C"args"%3A%5B%5D%7D