diff --git a/frontend/components/ModelForm.tsx b/frontend/components/ModelForm.tsx
index d458c5cf4..b93e24902 100644
--- a/frontend/components/ModelForm.tsx
+++ b/frontend/components/ModelForm.tsx
@@ -148,7 +148,6 @@ export const ModelTable = ({
})),
[tableFields],
)
-
tableFields = tableFields.map((column, index) => {
if (column.converter) {
const renderFunction = column.converter
@@ -167,12 +166,12 @@ export const ModelTable = ({
tableFields.push({
name: 'Actions',
- render: (_, index) => (
+ render: (id) => (
{allowEditing && (
)}
- {actions && actions(objects[index])}
+ {actions && actions(objects[id])}
),
})
@@ -211,7 +210,9 @@ export const ModelTable = ({
item.id ? item : { ...item, id: index },
)}
columns={tableFields}
- searchableColumns={searchableColumns || []}
+ searchableColumns={
+ searchableColumns || tableFields.map((field) => field.name)
+ }
filterOptions={filterOptions || []}
/>
>
diff --git a/frontend/components/common/Table.tsx b/frontend/components/common/Table.tsx
index f73fa3ba2..dc31b7767 100644
--- a/frontend/components/common/Table.tsx
+++ b/frontend/components/common/Table.tsx
@@ -116,10 +116,12 @@ const Table = ({
return true
}
return searchableColumns.some((searchId) => {
- const strings = item[searchId].split(' ')
- return strings.some((string) =>
- string.toLowerCase().startsWith(searchQuery.toLowerCase()),
- )
+ if (typeof item[searchId] === 'string') {
+ const strings = item[searchId].split(' ')
+ return strings.some((string) =>
+ string.toLowerCase().startsWith(searchQuery.toLowerCase()),
+ )
+ } else return false
})
})
const filteredData = searchedData.filter((item) => {