-
Notifications
You must be signed in to change notification settings - Fork 44.7k
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
refactor(frontend): Update Supabase and backend API management #9036
Merged
ntindle
merged 10 commits into
dev
from
kpczerwinski/open-2214-fix-supabase-auth-sync-issues
Dec 18, 2024
Merged
refactor(frontend): Update Supabase and backend API management #9036
ntindle
merged 10 commits into
dev
from
kpczerwinski/open-2214-fix-supabase-auth-sync-issues
Dec 18, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
platform/frontend
AutoGPT Platform - Front end
platform/backend
AutoGPT Platform - Back end
labels
Dec 17, 2024
✅ Deploy Preview for auto-gpt-docs-dev canceled.
|
✅ Deploy Preview for auto-gpt-docs canceled.
|
autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts
Dismissed
Show dismissed
Hide dismissed
autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts
Dismissed
Show dismissed
Hide dismissed
kcze
commented
Dec 17, 2024
kcze
commented
Dec 17, 2024
kcze
commented
Dec 17, 2024
kcze
requested review from
ntindle,
Swiftyos,
Pwuts,
Bentlybro,
majdyz and
Abhi1992002
December 17, 2024 16:16
aarushik93
reviewed
Dec 17, 2024
aarushik93
previously approved these changes
Dec 17, 2024
Swiftyos
approved these changes
Dec 18, 2024
ntindle
deleted the
kpczerwinski/open-2214-fix-supabase-auth-sync-issues
branch
December 18, 2024 10:08
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently there are random issues (logout, auth desync) and inconveniences with how Supabase and backend API works.
Resolves:
Changes 🏗️
This PR streamlines how the Supabase and backend API is used to fix current errors with auth, remove unnecessary code and make it easier to use Supabase and backend API.
getServerSupabase
for server side that returnsSupabaseClient
.Spinner
component that is used for loading animation.useUser
, user is fetched inuseSupabase
already.create*Client
togetSupabaseServer
anduseSupabase
.AutoGPTServerAPI
class and renameBaseAutoGPTServerAPI
toBackendAPI
and use it instead.SupabaseProvider
context; supabase caches internally what's possible already.useSupabase
hook to its own file and update it.Helpful table
new BackendAPI();
new BackendAPI();
* oruseBackendAPI()
getServerSupabase();
useSupabase();
getServerUser();
**useSupabase();
*
BackendAPI
automatically chooses correct Supabase client, so while it's recommended to useuseBackendAPI()
, it's ok to usenew BackendAPI();
in client components and even memoize it:useMemo(() => new BackendAPI(), [])
.** The reason user isn't returned in
getServerSupabase
is because it forces async fetch but creating supabase doesn't, so it'd forcegetServerSupabase
to be async or return{ supabase: SupabaseClient, user: Promise<User> | null }
. For the same reasonuseSupabase
provides access tosupabase
immediately butuser
may be loading, so there'sisUserLoading
provided as well.Checklist 📋
For code changes:
Example test plan
For configuration changes:
.env.example
is updated or already compatible with my changesdocker-compose.yml
is updated or already compatible with my changesExamples of configuration changes