Skip to content

Commit 3ea785b

Browse files
committed
fix: on change being called in custom input without any change
1 parent 86bad54 commit 3ea785b

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/CustomInput/CustomInput.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ export const CustomInput = ({
6969
const handleOnBlur = (event) => {
7070
// NOTE: This is to prevent the input from being trimmed when the user do not want to trim the input
7171
if (!noTrim) {
72-
event.stopPropagation()
73-
event.target.value = event.target.value?.trim()
74-
onChange(event)
72+
const trimmedValue = event.target.value?.trim()
73+
74+
if (event.target.value !== trimmedValue) {
75+
event.stopPropagation()
76+
event.target.value = trimmedValue
77+
onChange(event)
78+
}
7579
}
7680
if (typeof onBlur === 'function') {
7781
onBlur(event)

0 commit comments

Comments
 (0)