File tree Expand file tree Collapse file tree
app/src/components/SettingsDrawer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -254,10 +254,11 @@ class Settings extends React.PureComponent<Props, State> {
254254 }
255255
256256 private onBlurMaxMessageSize = ( ) => {
257- const value = parseInt ( this . state . maxMessageSizeInput , 10 )
257+ const inputValue = this . state . maxMessageSizeInput . trim ( )
258+ const value = parseInt ( inputValue , 10 )
258259
259- // Validate and update the setting, or reset to current value if invalid
260- if ( ! isNaN ( value ) && value >= MAX_MESSAGE_SIZE_MIN && value <= MAX_MESSAGE_SIZE_MAX ) {
260+ // Validate: ensure the entire string is a valid number and within range
261+ if ( inputValue !== '' && ! isNaN ( value ) && String ( value ) === inputValue && value >= MAX_MESSAGE_SIZE_MIN && value <= MAX_MESSAGE_SIZE_MAX ) {
261262 this . props . actions . settings . setMaxMessageSize ( value )
262263 } else {
263264 // Reset to current valid value without triggering backend updates
You can’t perform that action at this time.
0 commit comments