next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

fix: refetch session even if there is no current session

Open OrJDev opened this issue 8 months ago • 3 comments

☕️ Reasoning

I have an app that automatically sign in on the server side after signing up with credentials, trying to refetch the session (after calling the server function) without hard refreshing the page seems to be impossible, that is because no functions update the session directly except for update, however this function is only a thing when the session is already fetched and exists on the client side, that makes it so there is no possible way to refetch the session at any time i want it to.

   const session = await getSession();
                        console.log({ session });
                        // const t = toast.success("Loggin in...");
                        const r = await update();
                        console.log({ r });

In this example session is an object and r is not defined

🧢 Checklist

  • [x] Documentation
  • [x] Tests
  • [x] Ready to be merged

🎫 Affected issues

📌 Resources

OrJDev avatar Jun 04 '24 19:06 OrJDev