Skip to content
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

Improve and fix client options parsing #50

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Improve and fix client options parsing #50

wants to merge 2 commits into from

Conversation

zoedsoupe
Copy link
Collaborator

Problem

This PR addresses the following issues:

  1. The Supabase client was throwing an error (function Supabase.Client.Auth.changeset/2 is undefined or private) when initializing with an auth key in the options map. Specifically, the function Supabase.Client.Auth.changeset/3 required a supabase_uri, but this wasn't properly handled during initialization, leading to crashes when the auth entry was present in the options.

  2. Minor inconsistencies in documentation and examples, making it harder for developers to use the library and configure client options properly.

Solution

  1. Refactored the Supabase.Client options parsing to handle the auth key correctly, ensuring the appropriate arguments are passed to Supabase.Client.Auth.changeset/2.

  2. Improved documentation and examples in the README.md to clarify usage of client options, including proper handling of the auth key.

  3. Updated related module and function documentation (@doc, @typedoc) to reflect the changes and ensure consistency.

  4. Added and updated tests to verify the behavior when initializing clients with custom options, including edge cases such as setting flow_type in auth, while correctly handle default options and merging.

Rationale

The changes were implemented to fix issue #45, ensuring developers can use the auth key in client options without encountering errors. Refactoring the options parsing logic and enhancing documentation improves the overall developer experience, aligns with best practices, and avoids ambiguity in API usage.

By making the auth configuration fully functional and improving examples, this PR resolves the root cause of the reported issue and reduces the likelihood of similar misunderstandings in the future.

@zoedsoupe
Copy link
Collaborator Author

this PR depends on #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant