Skip to content

Commit

Permalink
Improve UX by rendering delete button immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
vcarl committed May 13, 2024
1 parent 5316bea commit 08405e7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/commands/track.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const handler = async (
) => {
const { targetMessage: message, user } = interaction;

const { message: logMessage } = await reportUser({
const reportPromise = reportUser({
reason: ReportReasons.track,
message,
staff: user,
Expand All @@ -30,6 +30,10 @@ export const handler = async (
label="Delete message"
style="danger"
onClick={async () => {
// Need to ensure that we've finished reporting before we try to
// respond to a click event.
// Initiating at the top level and waiting here is a big UX win.
const { message: logMessage } = await reportPromise;
await Promise.allSettled([
message.delete(),
logMessage.reply({
Expand Down

0 comments on commit 08405e7

Please sign in to comment.