Skip to content

Conversation

@NollieChtn6
Copy link
Collaborator

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors user management by renaming the User interface to UserMapped and consolidating data fetching to use Zustand store. The changes eliminate duplicate GraphQL queries in the UserManager component by leveraging the centralized fetchUsers method from the user store, and fixes a critical bug where isLoading was incorrectly set to false when fetching users should set it to true.

  • Renamed User interface to UserMapped to better reflect its purpose
  • Removed redundant useGetUsersQuery hook from UserManager in favor of Zustand store's fetchUsers and users state
  • Fixed critical bug: isLoading now correctly set to true when fetching users begins
  • Improved code consistency with formatting and accessibility enhancements

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/store/userStore.ts Renamed User interface to UserMapped and fixed isLoading bug in fetchUsers
frontend/src/pages/ModificationProfile/ModificationProfile.tsx Updated import and type cast to use UserMapped
frontend/src/pages/Login/Login.tsx Simplified store selector by using object destructuring
frontend/src/pages/Admin/components/UserList.tsx Updated to use UserMapped type and applied code formatting
frontend/src/pages/Admin/components/UserEditForm.tsx Added accessibility attributes and type="button" to buttons, improved formatting
frontend/src/pages/Admin/components/UserCard.tsx Updated to use UserMapped type and applied code formatting
frontend/src/pages/Admin/UserManager.tsx Removed useGetUsersQuery hook and refetch calls in favor of Zustand store state and methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +45
if (isLoading) return <p>Chargement des utilisateurs...</p>;
if (!users.length) return <p>Aucun utilisateur trouvé.</p>;
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

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

The loading state check occurs before initial data fetch. If users is an empty array on first render and isLoading is false (initial state), it will immediately show 'Aucun utilisateur trouvé' even though users haven't been fetched yet. This creates a confusing UX where users see 'no users found' before any fetch attempt. This issue is related to the missing fetchUsers() call on mount.

Copilot uses AI. Check for mistakes.
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