supabase-community / gotrue-csharp

C# implementation of Supabase's GoTrue
https://supabase-community.github.io/gotrue-csharp/api/Supabase.Gotrue.Client.html
MIT License
39 stars 27 forks source link

Introduce LoadSessionAsync for async scenarios #107

Open joaompneves opened 3 weeks ago

joaompneves commented 3 weeks ago

What kind of change does this PR introduce?

Introduce the LoadSessionAsync to allow scenarios where LoadSession needs to load the session in an async way. In some cases it's not possible to load the session in a sync way, thus the introduction of this new method. I encountered a roadblock while trying to use this lib in a Blazor project, where the load session from local storage is done in an async way, and its not possible to force it to be sync.

What is the current behavior?

Currently its not possible to load session in an async way.

What is the new behavior?

Allow the session to be loaded asynchronously.

Additional context

I introduced an obsolete attribute to the LoadSession methods but redirected the LoadSessionAsync implementation to the LoadSession, to avoid breaking changes on existing consumers. New consumers that want to use LoadSessionAsync should implement that method and disregard the old one, as it should be removed in the future.