Repository navigation
refactor(supabase): drop rxdart dependency - #1569
Merged
Merged
Conversation
Removes the last remaining rxdart usage in the monorepo. The supabase package only used rxdart's BehaviorSubject in SupabaseStreamBuilder for latest-value replay to late subscribers. Replaces it with a small private _BehaviorSubject built on dart:async primitives (StreamController.broadcast + Stream.multi), matching the approach already used in gotrue (#1566).
This was referenced Jul 9, 2026
Tr00d
approved these changes
Jul 9, 2026
spydon
added a commit
that referenced
this pull request
Jul 9, 2026
## What Introduces a new published `supabase_common` package and moves the **non-breaking** shared/duplicated code from #1572 into it. **Stacked:** `main` ← #1569 (drop rxdart) ← #1571 (drop retry, in-house helper) ← **this PR**. > [!NOTE] > Review/merge in stack order. Retarget this PR's base as each parent merges (→ `refactor/inline-retry`, then `refactor/supabase-drop-rxdart`, then `main`). ## Moved into `supabase_common` | Item | Was | |------|-----| | `ToSnakeCase` enum extension | duplicated (byte-for-byte) in `gotrue` + `storage_client` | | Platform detection (`platform_io`/`platform_stub`) | duplicated in `supabase` + `supabase_flutter` (kept the extra `isRunningInFlutterTest`) | | `buildClientInfoHeader` (`X-Client-Info`) | built in all 7 client packages (simple + platform-aware forms) | | `isSuccessStatusCode` (2xx) | inlined/duplicated in `gotrue`, `storage_client`, `postgrest`, `functions_client` | | `FetchOptions` | duplicated internally in `gotrue` + `storage_client` | | `Base64Url` / PKCE / uuid helpers | `gotrue`-only; also fixes an intra-`gotrue` duplication in `jwt.dart` | | `ReplaySubject` | unifies gotrue's `_ReplaySubject` and supabase's `_BehaviorSubject` | | `retry` / `RetryOptions` helper | the in-house copy #1571 added to `gotrue` + `storage_client` (identical); `@internal` dropped since it is now used across packages | ## Not included - **Tier 3** (shared exception base, HTTP fetch wrappers, `RetryTimer`) — breaking, tracked under v3 (#1278). ## Notes - `supabase_common` is an internal, published package (client packages cannot depend on an unpublished local package). Its README flags it as internal with breaking changes expected. - Registered in the workspace, `test.yml` (`DART_PACKAGES` + Coveralls carryforward), and `release-pana.yml`. - No public API changes: every moved symbol was either internal or re-exported so consumers importing from the client packages are unaffected. ## Verification - `dart analyze` clean across the whole workspace. - `supabase_common` unit tests pass (ToSnakeCase, client-info header, isSuccessStatusCode, Base64Url, PKCE, uuid, ReplaySubject sync/async/replay/hooks/addStream, retry). - `gotrue` (constants/helper), `functions_client` (full suite), and `supabase` (utilities) tests pass locally. Backend-dependent suites run in CI. Refs #1572
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Removes the
rxdartdependency from thesupabasepackage. It was used in exactly one place:SupabaseStreamBuilder, which backed its stream controllers with rxdart'sBehaviorSubject.They are replaced with a small, private
_BehaviorSubject<T>built on top of the standarddart:asyncprimitives (StreamController.broadcast+Stream.multi).Why
rxdartwas pulling in a whole reactive-extensions library for a single feature: latest-value replay for late subscribers. This mirrors what #1566 already did forgotrue, and removesrxdartfrom the monorepo entirely.Note: #1566 only dropped rxdart from
gotrue; thesupabasepackage used it independently, and #1567 merely bumped its version constraint.Preserved behavior
.listen().onListen/onCancellifecycle hooks used to lazily start/tear down the realtime + postgrest fetch.Testing
dart analyzeclean and allsupabasepackage tests pass (mock_test.dart, client_test.dart).