diff --git a/src/pages/thread/SortBy.js b/src/pages/thread/SortBy.js
index 7625cc3..fe2171b 100644
--- a/src/pages/thread/SortBy.js
+++ b/src/pages/thread/SortBy.js
@@ -27,10 +27,11 @@ const sortBy = props => {
{
- if (e.target.value > props.global.state.maxComments)
+ if (parseInt(e.target.value) > props.global.state.maxComments && props.global.state.maxComments < maxCommentsLimit)
setReloadVisible(true)
- props.global.setMaxComments(e.target.value)
- }} value={props.global.state.maxComments} type='number' size='5' maxLength='5' required min='100' max={maxCommentsLimit} step='100' />
+ }} onBlur={e => {
+ e.target.value = props.global.setMaxComments(e.target.value)
+ }} defaultValue={props.global.state.maxComments} type='number' size='5' maxLength='5' required min='100' max={maxCommentsLimit} step='100' />
{reloadVisible && <>
location.replace(location.href)} type='button' value='Reload' />
diff --git a/src/state.js b/src/state.js
index 6781222..00ea632 100644
--- a/src/state.js
+++ b/src/state.js
@@ -50,6 +50,7 @@ class GlobalState extends Container {
maxComments = 100
put(maxCommentsKey, maxComments)
this.setState({maxComments})
+ return maxComments
}
setSuccess = () => this.setState({statusText: '', statusImage: '/images/success.png'})