Skip to content

Commit 1334324

Browse files
committed
fix: fixed logic for the limit number field
1 parent 3727ec6 commit 1334324

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/features/configuration/ConfigurationForm.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ interface ConfigurationFormProps {
88

99
export function ConfigurationForm({ settings, onUpdate, onPersist }: ConfigurationFormProps) {
1010
const handlePostLimitChange = (value: string) => {
11-
const parsedValue = parseInt(value, 10)
11+
// Allow empty string or numeric values only
12+
const numericValue = value.replace(/[^0-9]/g, '')
13+
const parsedValue = parseInt(numericValue, 10)
1214
onUpdate({ postLimit: Number.isNaN(parsedValue) ? 0 : parsedValue })
1315
}
1416

@@ -59,13 +61,12 @@ export function ConfigurationForm({ settings, onUpdate, onPersist }: Configurati
5961
<div className="form-group form-group-compact">
6062
<label className="form-label">Post Limit</label>
6163
<input
62-
type="number"
64+
type="text"
6365
value={settings.postLimit}
6466
onChange={(event) => handlePostLimitChange(event.target.value)}
6567
onBlur={onPersist}
6668
className="form-input"
67-
min="1"
68-
max="10000"
69+
placeholder="Enter number of posts (1-10000)"
6970
/>
7071
</div>
7172
</div>

0 commit comments

Comments
 (0)