Skip to content

Commit

Permalink
fix: Crash when editing column with only one defined min/max value (#897
Browse files Browse the repository at this point in the history
)

**Fix crash due to undefined min/max values causing toFixed error**

When editing a column with only one defined min or max value, the app
would crash with the error "cannot read properties of undefined (reading
'toFixed')".
To resolve this, we updated the validation logic to allow undefined
values for min and max. This prevents the app from attempting to format
undefined values, eliminating the crash and allowing users to safely
edit columns with incomplete min/max values.
  • Loading branch information
chavda-bhavik authored and Mayur committed Dec 7, 2024
2 parents c1cd3e6 + 20b69da commit 32dbbe6
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/api",
"version": "0.27.2",
"version": "0.27.3",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion apps/queue-manager/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/queue-manager",
"version": "0.27.2",
"version": "0.27.3",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
12 changes: 6 additions & 6 deletions apps/web/design-system/validation/MinMaxValidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,33 @@ export function MinMaxValidation({
control={control}
name={`validations.${index}.min`}
rules={{
validate: (value, formValues) => validateMinMax(value, (formValues.validations?.[index] as any).max),
validate: (value, formValues) => validateMinMax(value, (formValues.validations?.[index] as any)?.max),
}}
render={({ field }) => (
<NumberInput
size={size}
min={min}
placeholder={minPlaceholder}
error={(errors?.validations?.[index] as any)?.min?.message}
value={field.value}
onChange={(value) => (value === '' ? field.onChange(undefined) : field.onChange(value))}
value={field.value ? field.value : undefined}
onChange={(value) => field.onChange(value === '' ? undefined : value)}
/>
)}
/>
<Controller
control={control}
name={`validations.${index}.max`}
rules={{
validate: (value, formValues) => validateMinMax((formValues.validations?.[index] as any).min, value),
validate: (value, formValues) => validateMinMax((formValues.validations?.[index] as any)?.min, value),
}}
render={({ field }) => (
<NumberInput
size={size}
max={max}
placeholder={maxPlaceholder}
error={(errors?.validations?.[index] as any)?.max?.message}
value={field.value}
onChange={(value) => (value === '' ? field.onChange(undefined) : field.onChange(value))}
value={field.value ? field.value : undefined}
onChange={(value) => field.onChange(value === '' ? undefined : value)}
/>
)}
/>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/web",
"version": "0.27.2",
"version": "0.27.3",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion apps/widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/widget",
"version": "0.27.2",
"version": "0.27.3",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"libs/*",
"packages/*"
],
"version": "0.27.2"
"version": "0.27.3"
}
2 changes: 1 addition & 1 deletion libs/dal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/dal",
"version": "0.27.2",
"version": "0.27.3",
"author": "implerhq",
"license": "MIT",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion libs/embed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/embed",
"version": "0.27.2",
"version": "0.27.3",
"private": true,
"license": "MIT",
"author": "implerhq",
Expand Down
2 changes: 1 addition & 1 deletion libs/services/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/services",
"version": "0.27.2",
"version": "0.27.3",
"description": "Reusable services to shared between backend api and queue-manager",
"license": "MIT",
"author": "implerhq",
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/shared",
"version": "0.27.2",
"version": "0.27.3",
"description": "Reusable types and classes to shared between apps and libraries",
"license": "MIT",
"author": "implerhq",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "impler.io",
"version": "0.27.1",
"version": "0.27.3",
"description": "Open source infrastructure to import data easily",
"packageManager": "pnpm@8.9.0",
"private": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/angular",
"version": "0.27.2",
"version": "0.27.3",
"description": "Angular library to show CSV Excel Importer in angular applications",
"license": "MIT",
"author": "implerhq",
Expand Down Expand Up @@ -52,6 +52,6 @@
"typescript": "^4.4.4"
},
"dependencies": {
"@impler/client": "^0.27.2"
"@impler/client": "^0.27.3"
}
}
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/client",
"version": "0.27.2",
"version": "0.27.3",
"description": "API client to be used in end user environments",
"license": "MIT",
"author": "implerhq",
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/react",
"version": "0.27.2",
"version": "0.27.3",
"description": "React library to show CSV Excel Importer in react applications",
"license": "MIT",
"author": "implerhq",
Expand Down Expand Up @@ -53,6 +53,6 @@
"typescript": "^4.4.4"
},
"dependencies": {
"@impler/client": "^0.27.2"
"@impler/client": "^0.27.3"
}
}

0 comments on commit 32dbbe6

Please sign in to comment.