Skip to content

feat(client): members_settings_page_add_restriction#1263

Merged
anurag91jain merged 1 commit intodevfrom
Member-Settings-page-adds-restriction
Jun 5, 2025
Merged

feat(client): members_settings_page_add_restriction#1263
anurag91jain merged 1 commit intodevfrom
Member-Settings-page-adds-restriction

Conversation

@aditiiisinhaa
Copy link
Copy Markdown
Contributor

Description

Member Settings page allows user to add multiple subsequent member without a fail.

Changes Made

Earlier Member Settings page allows user to add 1 new member, adding a subsequent member led to form failure with the error "Form is Invalid. model_usage_restriction is a required field."
Now user can add multiple subsequent user without any error.

How to Test

  1. Go to Settings page
  2. Click on 'Admin On'
  3. Click on 'Member Settings'
  4. Click on 'Add Members'
  5. Select 'Native' for type
  6. Enter a user id
  7. Enter a name
  8. Enter a phone number
  9. Click on 'Save'
  10. Repeat steps 4 through 9 using distinct values for user id, name, and phone number
  11. User doesn't get error while adding multiple subsequent members.

@aditiiisinhaa aditiiisinhaa self-assigned this Jun 5, 2025
@aditiiisinhaa aditiiisinhaa requested a review from a team as a code owner June 5, 2025 06:27
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 5, 2025

@CodiumAI-Agent /describe

@QodoAI-Agent
Copy link
Copy Markdown

Title

feat(client): members_settings_page_add_restriction


User description

Description

Member Settings page allows user to add multiple subsequent member without a fail.

Changes Made

Earlier Member Settings page allows user to add 1 new member, adding a subsequent member led to form failure with the error "Form is Invalid. model_usage_restriction is a required field."
Now user can add multiple subsequent user without any error.

How to Test

  1. Go to Settings page
  2. Click on 'Admin On'
  3. Click on 'Member Settings'
  4. Click on 'Add Members'
  5. Select 'Native' for type
  6. Enter a user id
  7. Enter a name
  8. Enter a phone number
  9. Click on 'Save'
  10. Repeat steps 4 through 9 using distinct values for user id, name, and phone number
  11. User doesn't get error while adding multiple subsequent members.

PR Type

Bug fix


Description

  • Set default model_usage_restriction on reset

  • Ensure new users have non-null restriction

  • Prevent form error when adding members


Changes walkthrough 📝

Relevant files
Bug fix
UserAddOverlay.tsx
Set default model_usage_restriction on reset                         

packages/client/src/components/settings/UserAddOverlay.tsx

  • Added model_usage_restriction default in reset hook
+1/-0     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown

    github-actions bot commented Jun 5, 2025

    @CodiumAI-Agent /review

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Default Value Type

    Assigning the string "null" as a fallback for model_usage_restriction may not match the form schema or expected type and could trigger validation errors. Consider using null (without quotes) or an empty string if that's acceptable.

    model_usage_restriction: user?.model_usage_restriction ?? 'null', // always set default for new user

    @github-actions
    Copy link
    Copy Markdown

    github-actions bot commented Jun 5, 2025

    @CodiumAI-Agent /improve

    @QodoAI-Agent
    Copy link
    Copy Markdown

    QodoAI-Agent commented Jun 5, 2025

    PR Code Suggestions ✨

    Latest suggestions up to ce45aae

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Use null literal default

    Replace the string 'null' with the actual null literal to ensure the form field's
    type remains nullable instead of a string, preventing potential type errors
    downstream.

    packages/client/src/components/settings/UserAddOverlay.tsx [203]

    -model_usage_restriction: user?.model_usage_restriction ?? 'null', // always set default for new user
    +model_usage_restriction: user?.model_usage_restriction ?? null, // always set default for new user
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion ensures the model_usage_restriction field’s type remains nullable rather than a string, preventing downstream type errors.

    Medium

    Previous suggestions

    Suggestions up to commit ce45aae
    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Use null default

    Use a null value instead of the string "null" to align with the expected type and
    prevent form value mismatches.

    packages/client/src/components/settings/UserAddOverlay.tsx [203]

    -model_usage_restriction: user?.model_usage_restriction ?? 'null', // always set default for new user
    +model_usage_restriction: user?.model_usage_restriction ?? null, // always set default for new user
    Suggestion importance[1-10]: 8

    __

    Why: Changing the default from a string "null" to null prevents a type mismatch for model_usage_restriction and avoids potential form errors.

    Medium
    General
    Add reset to deps

    Add reset to the dependency array so the effect reruns if the reset function
    identity changes, satisfying exhaustive-deps lint rules.

    packages/client/src/components/settings/UserAddOverlay.tsx [205]

    -}, [user, open]);
    +}, [user, open, reset]);
    Suggestion importance[1-10]: 4

    __

    Why: Including reset in the dependency array adheres to exhaustive-deps lint rules but has minimal impact on functionality since reset identity rarely changes.

    Low

    @aditiiisinhaa
    Copy link
    Copy Markdown
    Contributor Author

    Here is the screenshot of how it appears after adding subsequent user:

    addMemberUser

    @aditiiisinhaa aditiiisinhaa linked an issue Jun 5, 2025 that may be closed by this pull request
    Copy link
    Copy Markdown
    Contributor

    @AAfghahi AAfghahi left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Tested and this works.

    @anurag91jain anurag91jain merged commit 22034e3 into dev Jun 5, 2025
    4 checks passed
    @anurag91jain anurag91jain deleted the Member-Settings-page-adds-restriction branch June 5, 2025 19:32
    @github-actions
    Copy link
    Copy Markdown

    github-actions bot commented Jun 5, 2025

    @CodiumAI-Agent /update_changelog

    @QodoAI-Agent
    Copy link
    Copy Markdown

    Changelog updates: 🔄

    2025-06-05 #1263

    Added

    • Enable adding multiple members in Member Settings without form errors.

    to commit the new content to the CHANGELOG.md file, please type:
    '/update_changelog --pr_update_changelog.push_changelog_changes=true'

    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.

    Member Settings page adds restrictions

    4 participants