From 89cb1ab7b8581f7ac6b9b1fbf46218c6e0e24aef Mon Sep 17 00:00:00 2001 From: Lukasz Mierzwa Date: Wed, 1 Apr 2026 08:54:02 +0100 Subject: [PATCH] fix(ui): don't re-fetch matcher counters on comment change --- .../Components/SilenceModal/SilenceForm.tsx | 52 ++++++++++--------- .../SilenceMatch/LabelValueInput.tsx | 9 +++- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/ui/src/Components/SilenceModal/SilenceForm.tsx b/ui/src/Components/SilenceModal/SilenceForm.tsx index a361ab827..d482dd187 100644 --- a/ui/src/Components/SilenceModal/SilenceForm.tsx +++ b/ui/src/Components/SilenceModal/SilenceForm.tsx @@ -35,6 +35,32 @@ import { DateTimeSelect } from "./DateTimeSelect"; import PayloadPreview from "./PayloadPreview"; import { IconInput, AuthenticatedAuthorInput } from "./AuthorInput"; +const CommentInput: FC<{ + silenceFormStore: SilenceFormStore; +}> = observer(({ silenceFormStore }) => ( + silenceFormStore.data.setComment(event.target.value)} + /> +)); + +const AuthorInput: FC<{ + silenceFormStore: SilenceFormStore; +}> = observer(({ silenceFormStore }) => ( + silenceFormStore.data.setAuthor(event.target.value)} + /> +)); + const ShareButton: FC<{ silenceFormStore: SilenceFormStore; }> = observer(({ silenceFormStore }) => { @@ -170,14 +196,6 @@ const SilenceForm: FC<{ silenceFormStore.data.addEmptyMatcher(); }; - const onAuthorChange = (author: string) => { - silenceFormStore.data.setAuthor(author); - }; - - const onCommentChange = (comment: string) => { - silenceFormStore.data.setComment(comment); - }; - const handleSubmit = action((event: SyntheticEvent) => { event.preventDefault(); @@ -230,24 +248,10 @@ const SilenceForm: FC<{ {alertStore.info.authentication.enabled ? ( ) : ( - onAuthorChange(event.target.value)} - /> + )} - onCommentChange(event.target.value)} - /> +
makeValueContainer(silenceFormStore, matcher), + [silenceFormStore, matcher], + ); + return (