Refactor useSupabase hook to be idiomatic (#2017)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Moves Supabase data fetching/mutations to React Query and aligns UI
with new query states for clearer loading/errors and cache-driven
updates.
>
> - Removed most Supabase atoms; kept `lastLogTimestampAtom` only
> - New `useSupabase` exposes React Query queries (`organizations`,
`projects`, `branches`) and mutations (delete org, set/unset app
project, edge logs) with invalidate/refetch helpers
> - `SupabaseConnector` and `SupabaseIntegration` now use `refetch*`,
granular `isLoading*/error` flags, and updated handlers; branch select
disabled via `isLoadingBranches`/`isSettingAppProject`
> - `PreviewPanel` switches `loadEdgeLogs` to accept `{ projectId,
organizationSlug }` and continues polling
> - OAuth return flow now calls `refetchOrganizations`/`refetchProjects`
instead of manual load functions
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
573df5298f323854d4a8aa1ce5903b99e4caba62. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Refactored Supabase integration to use TanStack React Query for data
fetching and mutations. This makes loading/error handling clearer,
improves cache invalidation, and smooths the UI.
- **Refactors**
- Replaced Jotai state with React Query for organizations, projects, and
branches; removed related atoms.
- Added mutations for delete organization, set/unset app project, and
edge logs; invalidates org/project queries on deletion.
- Exposed granular states for organizations, projects, and branches;
removed selected project state.
- Updated SupabaseConnector/SupabaseIntegration to use refetch* methods
and new flags; PreviewPanel now calls loadEdgeLogs with params; disables
branch select while loading or setting.
<sup>Written for commit 573df5298f323854d4a8aa1ce5903b99e4caba62.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
---------
Co-authored-by:
cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
正在显示
请
注册
或者
登录
后发表评论