Skip to content

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

Conversation

piekarski-mateusz
Copy link
Contributor

@piekarski-mateusz piekarski-mateusz commented Jul 16, 2025

📑 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

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Sorting:
image

Default:
image

Copy link

vercel bot commented Jul 16, 2025

@piekarski-mateusz is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Jul 16, 2025

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. UI User interface related issues labels Jul 16, 2025
cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a 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

);
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 || "");

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link
Member

@shahargl shahargl left a comment

Choose a reason for hiding this comment

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

lgtm

@shahargl
Copy link
Member

super cool! @piekarski-mateusz

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 16, 2025
Copy link

vercel bot commented Jul 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
keep ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2025 1:26pm

@shahargl shahargl merged commit b189a4d into keephq:main Jul 16, 2025
20 of 21 checks passed
Copy link
Contributor

💪 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. 🙌
If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀

For any support, feel free to reach out on the community: https://slack.keephq.dev. Happy coding! 👩‍💻👨‍💻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files. UI User interface related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[➕ Feature]: Sort users in Incident creation assignee
3 participants