Skip to content

Commit 5e45e6e

Browse files
committed
perf: improve the input buttons and command input perf
1 parent f887ee1 commit 5e45e6e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

package/src/components/MessageInput/InputButtons.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export type InputButtonsWithContextProps = Pick<
3636

3737
const textComposerStateSelector = (state: TextComposerState) => ({
3838
command: state.command,
39-
text: state.text,
39+
hasText: !!state.text,
4040
});
4141

4242
export const InputButtonsWithContext = (props: InputButtonsWithContextProps) => {
@@ -51,12 +51,11 @@ export const InputButtonsWithContext = (props: InputButtonsWithContextProps) =>
5151
uploadFile: ownCapabilitiesUploadFile,
5252
} = props;
5353
const { textComposer } = useMessageComposer();
54-
const { command, text } = useStateStore(textComposer.state, textComposerStateSelector);
54+
const { command, hasText } = useStateStore(textComposer.state, textComposerStateSelector);
5555

5656
const [showMoreOptions, setShowMoreOptions] = useState(true);
5757
const { attachments } = useAttachmentManagerState();
5858

59-
const hasText = !!text;
6059
const shouldShowMoreOptions = hasText || !!attachments.length;
6160

6261
useEffect(() => {

package/src/components/MessageInput/components/CommandInput.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export type CommandInputProps = Partial<
2323
};
2424
const textComposerStateSelector = (state: TextComposerState) => ({
2525
command: state.command,
26-
text: state.text,
2726
});
2827

2928
export const CommandInput = ({

0 commit comments

Comments
 (0)