Skip to content

v3: expose PostgrestRetryOptions as a single public retry config #1576

Description

@spydon

Summary

In #1560 the PostgREST auto-retry settings became configurable (retryEnabled, retryCount, retryableStatusCodes). That PR is intentionally non-breaking, so those settings are exposed as individual named parameters on PostgrestClient, PostgrestClientOptions, and the builder constructors, and are bundled into a single immutable config only internally.

For v3 we should promote that internal bundle to a public options object and drop the individual parameters, so retry configuration is expressed as one value everywhere.

Proposed change (breaking)

  • Add a public PostgrestRetryOptions (or similar) with enabled, count, statusCodes, and the test-only delay.
  • Replace the individual retryEnabled / retryCount / retryableStatusCodes parameters on PostgrestClient with a single retryOptions parameter.
  • Do the same on PostgrestClientOptions in the supabase package (and surface it on SupabaseClient).
  • Keep the per-request override PostgrestBuilder.retry({bool enabled, int? count}) as the ergonomic shortcut; it can delegate to retryOptions.copyWith(...).

Why v3

Replacing the released retryEnabled parameter (shipped in postgrest v2.8.0) and the new retryCount / retryableStatusCodes parameters with a single object removes public constructor parameters, which is a breaking change for consumers.

Notes

The internal _RetryConfig added in #1560 already models this shape, so the v3 work is mostly promoting it to public API and swapping the constructor surface. This also removes the last places where retry fields are threaded individually (the PostgrestClient -> builder boundary and the sub-builder public constructors).

Metadata

Metadata

Assignees

No one assigned

    Labels

    postgrestThis issue or pull request is related to postgrestv3

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions