docs icon indicating copy to clipboard operation
docs copied to clipboard

Next.js example causes an infinite loop of rerendering

Open mjarosie opened this issue 2 years ago • 0 comments

Preflight checklist

Describe the bug

useEffect is missing a second parameter (an empty array I reckon? I'm not sure as I don't have much experience with React) in Next.js example tutorial - causing the page to send a GET request to http://localhost:3000/api/.ory/sessions/whoami every few hundred miliseconds. Unless that's an expected behaviour?

image

Reproducing the bug

Follow the tutorial, log in and open "developer tools" -> "network" tab to see lots of requests. Providing an empty array as a second parameter to useEffect fixes the issue.

Relevant log output

No response

Relevant configuration

No response

Version

N/A

On which operating system are you observing this issue?

No response

In which environment are you deploying?

No response

Additional Context

No response

mjarosie avatar Sep 26 '22 20:09 mjarosie