Anyone else having issues with `useSession` not be...
# ask-a-descoper
s
Anyone else having issues with
useSession
not being updated (only when refreshing browser window triggers update)?
g
Hey ๐Ÿ‘‹ We had another report on issue with that topic can you please elaborate more on the issue you experience? (noting that if you have an HAR file dem that would be very helpful ๐Ÿ™‚)
s
Gonna create one ๐Ÿ™‚
@great-diamond-35515 HAR file ready for you ๐Ÿ™‚ We are using nextjs 13.4 - wonder if the issue has something to do with SSR (did try with client component only, same thing though)
g
Thanks! I see that the refresh returns 400 few questions: 1. does this refresh happens after the user is authenticated? 2. if so - can you see a
DSR
under local storage/cookie? (Because I donโ€™t see it is sent) 3. did you change the descope project settings for token response method? if so - how is it configured? (see image) in general - I am curious about how Descope is used in the app, fyi there is a next sample app that uses descope here:: https://github.com/descope-sample-apps/next-js-sample-app
s
1. User is not yet logged in at this point 2. No
DSR
3. Default settings, cookie in body
g
Got it And what us the issue you experience?
s
We use the same flow as it's example app. Issue is flow is not rendered. I can record issue if needed?
@great-diamond-35515 recording of the issue https://www.loom.com/share/070c15d519ee4364b980d93d669f272b
g
Oh - I think that I understand whatโ€™s happening Flows can only rendered and loaded in the FE side So they need to be loaded dynamically and only on csr (aka ssr:false) The sample app shows how this should be achieved Iโ€™ll send a screenshot later ๐Ÿ˜ƒ
s
We use the same code as sample app ๐Ÿ™‚
Wonder if sample app works the same with nextjs 13.4
โ“ 1
g
Let me check that and Iโ€™ll get back to you soon
๐Ÿ™Œ 1
just a quick update - I managed to run everything on 13.4 (https://github.com/descope-sample-apps/next-js-sample-app/pull/14) if you can share more information / quick sample app of something that demonstrate the issue? how does
useSession
is used inside the login page etc?
s
This is login page
And that's signup flow component
const { isAuthenticated, isSessionLoading } = useSession()
inside
login.js
doesn't get triggered when you navigate from some other page it. But when you go to it directly or refresh works as expected
g
thanks, file shares really helps I will try to reproduce with that setup, will update soon
quick update - I have manage to reproduce. I believe I understand the root cause, will update shortly
๐Ÿ™Œ 1
s
Awesome ๐Ÿ™‚ Thanks!
g
@square-account-46211 we have fixed the issue a new version with that fix is avaialble (1.0.9) fyi there was an issue with the lifecycle of
useSession
hook when it was used across multiple pages thanks for the feedback! if any issue arise let me know ofc
s
Awesome! Checking now ๐Ÿ™‚
Works! ๐Ÿ‘‘
birthday party parrot 1
g
Great! Thanks for the help!