Skip to content

fix: fixing issue with getting user data #1289

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

Conversation

neelneelneel
Copy link
Contributor

Description

Fix with pulling members

Copy link

@CodiumAI-Agent /describe

@CodiumAI-Agent
Copy link

Title

fix: fixing issue with getting user data


User description

Description

Fix with pulling members


PR Type

Bug fix


Description

Use debouncedSearch for member queries
Compute dynamic pagination offset and limit
Remove unused imports (useLayoutEffect, Badge)


Changes walkthrough 📝

Relevant files
Bug fix
MembersTable.tsx
Update MembersTable API pagination parameters                       

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

  • Removed unused imports (useLayoutEffect, Badge)
  • Replaced configStore.store.user.id with debouncedSearch
  • Calculated offset and limit dynamically from page and rowsPerPage
  • +4/-5     

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

    @CodiumAI-Agent /review

    Copy link

    @CodiumAI-Agent /improve

    @CodiumAI-Agent
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    API Parameter Mismatch

    The new getEngineUsers call replaced configStore.store.user.id with debouncedSearch but it’s unclear if the API signature supports this ordering. Confirm that the backend client expects (adminMode, id, searchTerm, permission, offset, limit) and not the previous (adminMode, id, userId, permission, offset, limit).

    getMembersApi = [
        'getEngineUsers',
        adminMode,
        id,
        debouncedSearch ? debouncedSearch : undefined,
        permissionPriorityMapper(permissionFilter)?.permission,
        (page + 1) * rowsPerPage - rowsPerPage, // offset
        rowsPerPage, // limit
    ];
    Offset Calculation

    The offset is computed as (page + 1) * rowsPerPage - rowsPerPage which is equivalent to page * rowsPerPage but less clear. Consider simplifying the expression to avoid potential arithmetic mistakes.

    (page + 1) * rowsPerPage - rowsPerPage, // offset
    rowsPerPage, // limit

    @CodiumAI-Agent
    Copy link

    CodiumAI-Agent commented Jun 10, 2025

    PR Code Suggestions ✨

    Latest suggestions up to b91f439

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Restore user ID argument

    The search argument replaced the configStore.store.user.id parameter in the array,
    likely breaking the API signature; reinsert the user ID as the fourth element and
    then pass debouncedSearch as its own argument.

    packages/client/src/components/settings/MembersTable.tsx [305]

    +configStore.store.user.id,
     debouncedSearch ? debouncedSearch : undefined,
    Suggestion importance[1-10]: 9

    __

    Why: The removal of configStore.store.user.id likely breaks the API signature, re-inserting it ensures correct parameter order.

    High
    General
    Simplify offset calculation

    Simplify the offset calculation by using page * rowsPerPage to improve readability
    and avoid redundant arithmetic.

    packages/client/src/components/settings/MembersTable.tsx [307]

    -(page + 1) * rowsPerPage - rowsPerPage, // offset
    +page * rowsPerPage, // offset
    Suggestion importance[1-10]: 4

    __

    Why: Using page * rowsPerPage is equivalent and improves readability with no change in functionality.

    Low

    Previous suggestions

    Suggestions up to commit b91f439
    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Restore correct argument order

    Ensure that configStore.store.user.id is restored as the third argument and move
    debouncedSearch to the fourth slot to match the expected signature of
    getEngineUsers. This prevents replacing the user ID with the search term
    inadvertently.

    packages/client/src/components/settings/MembersTable.tsx [304-305]

     id,
    +configStore.store.user.id,
     debouncedSearch ? debouncedSearch : undefined,
    Suggestion importance[1-10]: 9

    __

    Why: Restoring configStore.store.user.id between id and the search term prevents breaking the expected API signature and fixes a critical bug.

    High
    General
    Default empty search string

    Use a fallback to an empty string for debouncedSearch instead of undefined to ensure
    the API always receives a consistent string type.

    packages/client/src/components/settings/MembersTable.tsx [305]

    -debouncedSearch ? debouncedSearch : undefined,
    +debouncedSearch || '',
    Suggestion importance[1-10]: 5

    __

    Why: Using an empty string ensures a consistent string type for the search parameter but only has minor impact on API behavior.

    Low
    Simplify offset calculation

    Simplify the offset calculation to page * rowsPerPage for clarity and to avoid
    potential arithmetic mistakes.

    packages/client/src/components/settings/MembersTable.tsx [307]

    -(page + 1) * rowsPerPage - rowsPerPage, // offset
    +page * rowsPerPage, // offset
    Suggestion importance[1-10]: 4

    __

    Why: Simplifying (page + 1) * rowsPerPage - rowsPerPage to page * rowsPerPage improves clarity with no functional change.

    Low

    @johbaxter
    Copy link
    Contributor

    image

    In a PR where we do code cleanup, please use correct api to get user data instead of indexing

    @johbaxter johbaxter merged commit 909b5ee into dev Jun 10, 2025
    4 checks passed
    @johbaxter johbaxter deleted the 1201-permissions-will-not-be-set-correctly-if-the-user-is-not-present-on-the-1st-page-of-pagination-in-appengine-settings branch June 10, 2025 15:35
    Copy link

    @CodiumAI-Agent /update_changelog

    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.

    Permissions will not be set correctly if the user is not present on the 1st page of pagination in app/engine settings
    3 participants