Skip to content

Commit 638af5a

Browse files
committed
fix: update error handling in DynamicDataTableRow for SelectPicker and Dropdown
1 parent 2007b0f commit 638af5a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Shared/Components/DynamicDataTable/DynamicDataTableRow.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,18 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
290290
? cellError[row.id][key]
291291
: { isValid: true, errorMessages: [] }
292292

293-
const isSelectText = row.data[key].type === DynamicDataTableRowDataType.SELECT_TEXT
293+
const isDropdown =
294+
row.data[key].type === DynamicDataTableRowDataType.SELECT_TEXT ||
295+
row.data[key].type === DynamicDataTableRowDataType.DROPDOWN
294296

295297
if (isValid) {
296298
return null
297299
}
298300

299-
// Adding 'no-error' class to hide error when SelectPickerTextArea is focused.
301+
// Adding 'no-error' class to hide error when SelectPicker or SelectPickerTextArea is focused.
300302
return (
301303
<div
302-
className={`dynamic-data-table__error bg__primary dc__border br-4 py-7 px-8 flexbox-col dc__gap-4 ${isSelectText ? 'no-error' : ''}`}
304+
className={`dynamic-data-table__error bg__primary dc__border br-4 py-7 px-8 flexbox-col dc__gap-4 ${isDropdown ? 'no-error' : ''}`}
303305
>
304306
{errorMessages.map((error) => renderErrorMessage(error))}
305307
</div>

src/Shared/Components/KeyValueTable/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const getKeyValueTableRows = ({
4040
}: Required<Pick<KeyValueTableProps, 'rows' | 'placeholder' | 'maskValue'>>): KeyValueTableInternalProps['rows'] => {
4141
const isMaskValue = maskValue && Object.keys(maskValue).length
4242

43-
const rows: KeyValueTableInternalProps['rows'] = initialRows.length
43+
const rows: KeyValueTableInternalProps['rows'] = initialRows?.length
4444
? initialRows.map(({ data: { key, value }, id }) => ({
4545
data: {
4646
key: {

0 commit comments

Comments
 (0)