Skip to content

Commit 53c5285

Browse files
committed
fix: input buttons hasText optimization
1 parent 40bd3cc commit 53c5285

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

package/src/components/MessageInput/InputButtons.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ export const InputButtonsWithContext = (props: InputButtonsWithContextProps) =>
5050
const { command } = useStateStore(customDataManager.state, customComposerDataSelector);
5151
const [showMoreOptions, setShowMoreOptions] = useState(true);
5252

53+
const hasText = !!text;
54+
5355
useEffect(() => {
54-
if (text.length > 0) {
55-
setShowMoreOptions(false);
56-
} else {
57-
setShowMoreOptions(true);
58-
}
59-
}, [text]);
56+
setShowMoreOptions(!hasText);
57+
}, [hasText]);
6058

6159
const {
6260
theme: {

0 commit comments

Comments
 (0)