supabase / auth-js

An isomorphic Javascript library for Supabase Auth.
MIT License
370 stars 165 forks source link

feat: add process lock for optional use in non-browser environments (React Native) #977

Closed hf closed 3 weeks ago

hf commented 3 weeks ago

When using the library in non-browser environments like React Native or other JavaScript-based runtimes (Electron's main process for example) certain race conditions could still occur.

We've received some signal from customers using React Native that at scale these become more visible. This is why I'm introducing a processLock that developers can import like so:

import { processLock } from '@supabase/auth-js/lib/locks'

And add to their apps by specifying the lock option with the process lock.