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: Make the return value of accessToken nullable #1332

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dshukertjr
Copy link
Member

What kind of change does this PR introduce?

Bug fix.

Reading through the documentation, it looks like the return value of the accessToken should allow null to be returned, but the current type doesn't allow null to be returned. This PR updates the return type of the accessToken function to allow null to be returned.

What is the current behavior?

The code sample from the docs has type error, because null cannot be returned from accessToken function.

import { createClient } from '@supabase/supabase-js'

const supabase = createClient('https://<supabase-project>.supabase.co', 'SUPABASE_ANON_KEY', {
  accessToken: async () => {
    ;(await firebase.auth().currentUser?.getIdToken(/* forceRefresh */ false)) ?? null
  },
})

What is the new behavior?

null can be returned from the function if no users are found.

@dshukertjr dshukertjr requested a review from hf December 12, 2024 05:44
@coveralls
Copy link

Pull Request Test Coverage Report for Build 12290594479

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 67.633%

Totals Coverage Status
Change from base Build 12280603551: 0.0%
Covered Lines: 99
Relevant Lines: 128

💛 - Coveralls

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