Skip to content
Discussion options

You must be logged in to vote

You can use a condition

const { session } = useSession()
useSWR(() => session?.id ? ["/v2/order/recipe/summary", session.id] : null, fetcher);

This way, SWR will not run the fetch until session is defined which will prevent possible failing requests.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pke
Comment options

Answer selected by pke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants