appwrite / demos-for-react

Demos and tutorials for getting started with Appwrite + React JS
https://appwrite.io
MIT License
91 stars 39 forks source link

Fixes issue where the cookie is not present upon redirect in Next.js server-side rendering demo #29

Open oconr opened 2 months ago

oconr commented 2 months ago

What does this PR do?

There is currently an issue with Next.js where setting a cookie using cookies() and then returning NextResponse will not add the cookie to that response meaning that the session is not set and requires a refresh. This adds the cookie to the response along side setting it using cookies() to make sure that upon redirecting, the session is present.

Test Plan

I manually tested this, both as a fresh install, on existing projects and had confirmation from others that this approach worked when they were using this as repo as a starting point.

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

Yes