Skip to content

Commit

Permalink
fix: clientFactory should be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and rexxars committed Dec 21, 2022
1 parent cf52ee7 commit d894d56
Showing 1 changed file with 5 additions and 3 deletions.
@@ -1,4 +1,4 @@
import {ClientConfig as SanityClientConfig, SanityClient} from '@sanity/client'
import createSanityClient, {ClientConfig as SanityClientConfig, SanityClient} from '@sanity/client'
import {defer} from 'rxjs'
import {map, shareReplay, startWith, switchMap} from 'rxjs/operators'
import {memoize} from 'lodash'
Expand All @@ -19,7 +19,7 @@ export interface AuthProvider {

/** @internal */
export interface AuthStoreOptions {
clientFactory: (options: SanityClientConfig) => SanityClient
clientFactory?: (options: SanityClientConfig) => SanityClient
projectId: string
dataset: string
/**
Expand Down Expand Up @@ -138,7 +138,7 @@ const getCurrentUser = async (
* @internal
*/
export function _createAuthStore({
clientFactory,
clientFactory: clientFactoryOption,
projectId,
dataset,
loginMethod = 'dual',
Expand All @@ -149,6 +149,8 @@ export function _createAuthStore({
// for cookie-based auth
const {broadcast, messages} = createBroadcastChannel<string | null>(`dual_mode_auth_${projectId}`)

const clientFactory = clientFactoryOption ?? createSanityClient

// // TODO: there is currently a bug where the AuthBoundary flashes the
// // `NotAuthenticatedComponent` on the first load after a login with
// // cookieless mode. A potential solution to fix this bug is to delay
Expand Down

1 comment on commit d894d56

@vercel
Copy link

@vercel vercel bot commented on d894d56 Dec 21, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.