Skip to content

chore: fix updatePrefs not working with new object based params #1144

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

Merged
merged 2 commits into from
Aug 11, 2025

Conversation

ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Aug 9, 2025

What does this PR do?

  • since for updatePrefs old method's first param was also an object, made the check a bit stricter to see if prefs exist in the object:

      if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'prefs' in paramsOrFirst) {
    

    still doesnt cover the edge case where key of the preferences is also prefs... but the change is breaking 😅

  • update deprecated message to be clearer with examples:

     /**
      * @deprecated Parameter-based methods will be removed in the upcoming version.
      * Please use the object based method instead for better developer experience.
      *
      * @example
      * // Old (deprecated)
      * updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>;
      *
      * // New (object based)
      * updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { prefs: Partial<Preferences>  }): Promise<Models.User<Preferences>>;
      */

Test Plan

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

yes.

@abnegate abnegate merged commit 69a931f into master Aug 11, 2025
38 checks passed
@abnegate abnegate deleted the fix-updatePrefs branch August 11, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants