Skip to content

Commit 62459f8

Browse files
committed
Fixes issue with deleting rows
1 parent 9d21daa commit 62459f8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/javascript/components/data-tables/datastore/schema/class-fields-schema.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ const createSchemaEditSchema = (rows, setState, isSchemaModified) => {
1919

2020
const handleFieldDelete = (index) => {
2121
const field = rows.find((field) => field.id === index);
22-
const fId = field.field_id || null;
23-
http.post(`/miq_ae_class/field_delete/${fId}?arr_id=${index}`, { skipErrors: [400] })
22+
const arrId = rows.findIndex((field) => field.id === index);
23+
const fId = field.field_id;
24+
const url = `/miq_ae_class/field_delete${fId ? `/${fId}` : ''}?arr_id=${arrId}`;
25+
http.post(url, { skipErrors: [400] })
2426
.then(() => {
2527
setState((prev) => ({
2628
...prev,

0 commit comments

Comments
 (0)