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

fix: update type, remove unused imports, define AuthEvent type #47

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/createServerClient.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { createClient, SupabaseClient } from "@supabase/supabase-js";
import {
AuthChangeEvent,
createClient,
SupabaseClient,
} from "@supabase/supabase-js";
import type {
GenericSchema,
SupabaseClientOptions,
} from "@supabase/supabase-js/dist/module/lib/types";

import { VERSION } from "./version";
import {
DEFAULT_COOKIE_OPTIONS,
combineChunks,
createChunks,
deleteChunks,
isBrowser,
isChunkLike,
} from "./utils";
import { createStorageFromOptions, applyServerStorage } from "./cookies";
import type {
CookieOptionsWithName,
Expand Down Expand Up @@ -75,7 +71,7 @@ export function createServerClient<
* **Use in pages, components or routes.**
*
* To use Supabase features server-side rendered in pages, components or routes
* (a.k.a. actions / APIs) you must create a client with this funciton. Not all
* (a.k.a. actions / APIs) you must create a client with this function. Not all
* frameworks allow the ability to set cookies or response headers when pages
* or components are rendered. In those cases you _can omit `setAll` (or the
* deprecated `set`, `remove`) cookie option methods_. **It is strongly
Expand Down Expand Up @@ -180,7 +176,7 @@ export function createServerClient<
},
);

client.auth.onAuthStateChange(async (event) => {
client.auth.onAuthStateChange(async (event: AuthChangeEvent) => {
// The SIGNED_IN event is fired very often, but we don't need to
// apply the storage each time it fires, only if there are changes
// that need to be set -- which is if setItems / removeItems have
Expand Down