Skip to content

Commit

Permalink
fix: fix createBrowserClient deprecation tsdoc (#17)
Browse files Browse the repository at this point in the history
Fixes the deprecation TSDoc on `createBrowserClient` to not show up if
you don't pass in any options.

Discussion:
https://github.com/orgs/supabase/discussions/27037#discussioncomment-9764831
  • Loading branch information
hf authored Jun 20, 2024
1 parent 0b5f881 commit 1df70ad
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/createBrowserClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ import { createStorageFromOptions } from "./cookies";
let cachedBrowserClient: SupabaseClient<any, any, any> | undefined;

/**
* @deprecated Please specify `getAll` and `setAll` cookie methods instead of
* the `get`, `set` and `remove`. These will not be supported in the next major
* version.
* Creates a Supabase Client for use in a browser environment.
*
* In most cases you should not configure the `options.cookies` object, as this
* is automatically handled for you. If you do customize this, prefer using the
* `getAll` and `setAll` functions over `get`, `set` and `remove`. The latter
* are deprecated due to being difficult to correctly implement and not
* supporting some edge-cases. Both `getAll` and `setAll` (or both `get`, `set`
* and `remove`) must be provided. Failing to provide the methods for setting
* will throw an exception, and in previous versions of the library will result
* in difficult to debug authentication issues such as random logouts, early
* session termination or problems with inconsistent state.
*
* @param supabaseUrl The URL of the Supabase project.
* @param supabaseKey The `anon` API key of the Supabase project.
* @param options Various configuration options.
*/
export function createBrowserClient<
Database = any,
Expand All @@ -45,29 +57,17 @@ export function createBrowserClient<
supabaseUrl: string,
supabaseKey: string,
options?: SupabaseClientOptions<SchemaName> & {
cookies: CookieMethodsBrowserDeprecated;
cookies?: CookieMethodsBrowser;
cookieOptions?: CookieOptionsWithName;
cookieEncoding?: "raw" | "base64url";
isSingleton?: boolean;
},
): SupabaseClient<Database, SchemaName, Schema>;

/**
* Creates a Supabase Client for use in a browser environment.
*
* In most cases you should not configure the `options.cookies` object, as this
* is automatically handled for you. If you do customize this, prefer using the
* `getAll` and `setAll` functions over `get`, `set` and `remove`. The latter
* are deprecated due to being difficult to correctly implement and not
* supporting some edge-cases. Both `getAll` and `setAll` (or both `get`, `set`
* and `remove`) must be provided. Failing to provide the methods for setting
* will throw an exception, and in previous versions of the library will result
* in difficult to debug authentication issues such as random logouts, early
* session termination or problems with inconsistent state.
*
* @param supabaseUrl The URL of the Supabase project.
* @param supabaseKey The `anon` API key of the Supabase project.
* @param options Various configuration options.
* @deprecated Please specify `getAll` and `setAll` cookie methods instead of
* the `get`, `set` and `remove`. These will not be supported in the next major
* version.
*/
export function createBrowserClient<
Database = any,
Expand All @@ -81,7 +81,7 @@ export function createBrowserClient<
supabaseUrl: string,
supabaseKey: string,
options?: SupabaseClientOptions<SchemaName> & {
cookies?: CookieMethodsBrowser;
cookies: CookieMethodsBrowserDeprecated;
cookieOptions?: CookieOptionsWithName;
cookieEncoding?: "raw" | "base64url";
isSingleton?: boolean;
Expand Down

0 comments on commit 1df70ad

Please sign in to comment.