Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: make cookie functions optional in server client #654

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

dijonmusters
Copy link
Contributor

What kind of change does this PR introduce?

Chore

What is the current behavior?

Cookie functions are mandatory when creating s Server client

What is the new behavior?

Cookie functions are optional when creating s Server client

Additional context

Next.js Server Components cannot set or remove cookies. It doesn't make sense to declare these empty functions to be able to use a Supabase client in a Server Component

remove: (key: string, options?: CookieOptions) => Promise<void> | void;
};
export type BrowserCookieMethods = {
export type CookieMethods = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also realised the options parameter should not be optional. Both createServerClient and createBrowserClient pass in the default cookie options when they call these functions

@dijonmusters dijonmusters merged commit b9099fd into main Oct 26, 2023
3 checks passed
@dijonmusters dijonmusters deleted the chore/make-cookie-functions-optional-for-server branch October 26, 2023 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants