-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Sort user list and add default current user to incident creation #5186
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
feat: Sort user list and add default current user to incident creation #5186
Conversation
@piekarski-mateusz is attempting to deploy a commit to the KeepHQ Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Assignee State Fails to Default to Current User
The incidentAssignee
state in the incident creation form fails to default to the current user. This occurs because useState
initializes the assignee using currentUser?.email
only once on the component's initial render. As useSession()
loads asynchronously, currentUser
is often undefined
at this point, causing the assignee to default to an empty string. The state does not automatically update when the session data subsequently loads, preventing the intended pre-selection of the current user.
keep-ui/features/incidents/create-or-update-incident/ui/create-or-update-incident-form.tsx#L40-L45
keep/keep-ui/features/incidents/create-or-update-incident/ui/create-or-update-incident-form.tsx
Lines 40 to 45 in 03c0360
); | |
const { data: session } = useSession(); | |
const currentUser = session?.user; | |
const [incidentName, setIncidentName] = useState<string>(""); | |
const [incidentUserSummary, setIncidentUserSummary] = useState<string>(""); | |
const [incidentAssignee, setIncidentAssignee] = useState<string>(currentUser?.email || ""); |
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
super cool! @piekarski-mateusz |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
💪 Fantastic work @piekarski-mateusz! Your very first PR to keep has been merged! 🎉🥳 You've just taken your first step into open-source, and we couldn't be happier to have you onboard. 🙌 For any support, feel free to reach out on the community: https://slack.keephq.dev. Happy coding! 👩💻👨💻 |
📑 Description
This PR changes the way the user chooses the Incident assignee when creating an Incident.
The new changes include having the current user being chosen by default and sorting the user list alphabetically
Issue
closes #5187
✅ Checks
ℹ Additional Information
Sorting:

Default:
