Skip to content

fix: allow use of createBrowserClient without window present#20

Merged
hf merged 1 commit into
mainfrom
hf/fix-allow-use-of-create-browser-client-without-window
Jun 24, 2024
Merged

fix: allow use of createBrowserClient without window present#20
hf merged 1 commit into
mainfrom
hf/fix-allow-use-of-create-browser-client-without-window

Conversation

@hf
Copy link
Copy Markdown
Collaborator

@hf hf commented Jun 23, 2024

Allows calling createBrowserClient without throwing an error when not in a browser context (i.e. window is missing).

This is especially useful when using in Next.js Pre-Rendering mode where the client's non-auth namespaces could be useful, such as to load public data from PostgREST.

If however the auth namespace is used, the setAll handler function will throw an error indicating to the user that they're doing something wrong. This shouldn't come up in Pre-Rendering mode ever.

See: https://github.com/orgs/supabase/discussions/27037#discussioncomment-9852948

Comment thread src/cookies.ts Outdated
Comment thread src/cookies.ts
@activenode
Copy link
Copy Markdown

I think that looks great

@hf hf force-pushed the hf/fix-allow-use-of-create-browser-client-without-window branch from 45f860b to 58fe199 Compare June 24, 2024 08:32
@hf hf merged commit 27d868d into main Jun 24, 2024
@hf hf deleted the hf/fix-allow-use-of-create-browser-client-without-window branch June 24, 2024 11:17
hf pushed a commit that referenced this pull request Jun 24, 2024
🤖 I have created a release *beep* *boop*
---


## [0.4.0](v0.3.0...v0.4.0)
(2024-06-24)


### Features

* full rewrite using `getAll` and `setAll` cookie methods
([#1](#1))
([b6ae192](b6ae192))


### Bug Fixes

* allow use of `createBrowserClient` without `window` present
([#20](#20))
([27d868d](27d868d))
* deprecate `parse`, `serialize` exports for more useful functions
([#14](#14))
([0b5f881](0b5f881))
* fix `createBrowserClient` deprecation tsdoc
([#17](#17))
([1df70ad](1df70ad))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants