supabase/ssr

Update Pages Router for 0.4.0 update

Closed this issue · 1 comments

Improve documentation

Link

https://supabase.com/docs/guides/auth/server-side/nextjs?queryGroups=router&router=pages

Describe the problem

Current documentation shows a deprecation warning when implemented due to value potentially being undefined.

return Object.keys(req.cookies).map((name) => ({ name, value: req.cookies[name] }))

Describe the improvement

Update server-props.ts and api.ts snippets to show how to gracefully solve this warning.

Additional context

If the solution is just to do something like this:

return Object.keys(req.cookies).map((name) => ({ name, value: req.cookies[name] || '' }))

I'm happy to make that update

hf commented

Sure please do it!