Skip to content

Commit f8e2364

Browse files
committed
chore: move code blocks together and leave comment
1 parent 328797e commit f8e2364

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/components/MessageInput/MessageInputFlat.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ export const MessageInputFlat = <
7171
StopAIGenerationButton: StopAIGenerationButtonOverride,
7272
EmojiPicker,
7373
} = useComponentContext<StreamChatGenerics>('MessageInputFlat');
74-
const StopAIGenerationButton =
75-
StopAIGenerationButtonOverride === undefined
76-
? DefaultStopAIGenerationButton
77-
: StopAIGenerationButtonOverride;
7874
const {
7975
acceptedFiles = [],
8076
multipleUploads,
@@ -146,6 +142,15 @@ export const MessageInputFlat = <
146142
const recordingEnabled = !!(recordingController.recorder && navigator.mediaDevices); // account for requirement on iOS as per this bug report: https://bugs.webkit.org/show_bug.cgi?id=252303
147143
const isRecording = !!recordingController.recordingState;
148144

145+
/* This bit here is needed to make sure that we can get rid of the default behaviour
146+
* if need be. Essentially this allows us to pass StopAIGenerationButton={null} and
147+
* completely circumvent the default logic if it's not what we want. We need it as a
148+
* prop because there is no other trivial way to override the SendMessage button otherwise.
149+
*/
150+
const StopAIGenerationButton =
151+
StopAIGenerationButtonOverride === undefined
152+
? DefaultStopAIGenerationButton
153+
: StopAIGenerationButtonOverride;
149154
const shouldDisplayStopAIGeneration =
150155
[AIStates.Thinking, AIStates.Generating].includes(aiState) && !!StopAIGenerationButton;
151156

0 commit comments

Comments
 (0)