diff --git a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/CreateRow.jsx b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/CreateRow.jsx
index 08406a588f..262bbc6ee3 100644
--- a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/CreateRow.jsx
+++ b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/CreateRow.jsx
@@ -7,7 +7,7 @@ import Select from '@/_ui/Select';
import { uniqueId } from 'lodash';
import { useMounted } from '@/_hooks/use-mount';
-export const CreateRow = ({ currentState, optionchanged, options, darkMode }) => {
+export const CreateRow = React.memo(({ currentState, optionchanged, options, darkMode }) => {
const { organizationId, selectedTable, columns, setColumns } = useContext(TooljetDatabaseContext);
const [columnOptions, setColumnOptions] = useState(options['create_row'] || {});
@@ -178,4 +178,4 @@ export const CreateRow = ({ currentState, optionchanged, options, darkMode }) =>
);
-};
+});
diff --git a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/DeleteRows.jsx b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/DeleteRows.jsx
index 07430d48da..366a694419 100644
--- a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/DeleteRows.jsx
+++ b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/DeleteRows.jsx
@@ -8,7 +8,7 @@ import Select from '@/_ui/Select';
import { operators } from '@/TooljetDatabase/constants';
import { useMounted } from '@/_hooks/use-mount';
-export const DeleteRows = ({ currentState, optionchanged, options, darkMode }) => {
+export const DeleteRows = React.memo(({ currentState, optionchanged, options, darkMode }) => {
const { organizationId, selectedTable, columns, setColumns } = useContext(TooljetDatabaseContext);
const [deleteRowsOptions, setDeleteRowsOptions] = useState(options['delete_rows'] || {});
@@ -83,21 +83,76 @@ export const DeleteRows = ({ currentState, optionchanged, options, darkMode }) =
}
}
- const displayColumns = columns.map(({ accessor }) => ({
- value: accessor,
- label: accessor,
- }));
+ const RenderFilterFields = ({ column, operator, value, id }) => {
+ const displayColumns = columns.map(({ accessor }) => ({
+ value: accessor,
+ label: accessor,
+ }));
- const handleColumnChange = (id, selectedOption) => {
- updateFilterOptionsChanged({ ...deleteRowsOptions?.where_filters[id], ...{ column: selectedOption } });
- };
+ const handleColumnChange = (selectedOption) => {
+ updateFilterOptionsChanged({ ...deleteRowsOptions?.where_filters[id], ...{ column: selectedOption } });
+ };
- const handleOperatorChange = (id, selectedOption) => {
- updateFilterOptionsChanged({ ...deleteRowsOptions?.where_filters[id], ...{ operator: selectedOption } });
- };
+ const handleOperatorChange = (selectedOption) => {
+ updateFilterOptionsChanged({ ...deleteRowsOptions?.where_filters[id], ...{ operator: selectedOption } });
+ };
- const handleValueChange = (id, newValue) => {
- updateFilterOptionsChanged({ ...deleteRowsOptions?.where_filters[id], ...{ value: newValue } });
+ const handleValueChange = (newValue) => {
+ updateFilterOptionsChanged({ ...deleteRowsOptions?.where_filters[id], ...{ value: newValue } });
+ };
+
+ return (
+
{Object.values(deleteRowsOptions?.where_filters || {}).map((filter) => (
-
-
-
-
-
-
-
- handleValueChange(newValue, filter.id)}
- />
-
-
-
-
-
-
+
))}
);
-};
+});
diff --git a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/ListRows.jsx b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/ListRows.jsx
index 1ede59e8a2..02b25a6018 100644
--- a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/ListRows.jsx
+++ b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/ListRows.jsx
@@ -8,7 +8,7 @@ import Select from '@/_ui/Select';
import { operators } from '@/TooljetDatabase/constants';
import { useMounted } from '@/_hooks/use-mount';
-export const ListRows = ({ currentState, optionchanged, options, darkMode }) => {
+export const ListRows = React.memo(({ currentState, optionchanged, options, darkMode }) => {
const { organizationId, selectedTable, columns, setColumns } = useContext(TooljetDatabaseContext);
const [listRowsOptions, setListRowsOptions] = useState(() => options['list_rows'] || {});
@@ -115,6 +115,78 @@ export const ListRows = ({ currentState, optionchanged, options, darkMode }) =>
}
}
+ const RenderFilterFields = ({ column, operator, value, id }) => {
+ const displayColumns = columns.map(({ accessor }) => ({
+ value: accessor,
+ label: accessor,
+ }));
+
+ const handleColumnChange = (selectedOption) => {
+ updateFilterOptionsChanged({ ...listRowsOptions?.where_filters[id], ...{ column: selectedOption } });
+ };
+
+ const handleOperatorChange = (selectedOption) => {
+ updateFilterOptionsChanged({ ...listRowsOptions?.where_filters[id], ...{ operator: selectedOption } });
+ };
+
+ const handleValueChange = (newValue) => {
+ updateFilterOptionsChanged({ ...listRowsOptions?.where_filters[id], ...{ value: newValue } });
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+ handleValueChange(newValue)}
+ />
+
+
+
+
+
+
+ );
+ };
+
const RenderSortFields = ({ column, order, id }) => {
const orders = [
{ value: 'asc', label: 'Ascending' },
@@ -179,22 +251,6 @@ export const ListRows = ({ currentState, optionchanged, options, darkMode }) =>
const updateLimitOptions = (limit) => {
if (listRowsOptions?.limit ?? '' !== limit) setListRowsOptions({ ...listRowsOptions, ...{ limit } });
};
- const displayColumns = columns.map(({ accessor }) => ({
- value: accessor,
- label: accessor,
- }));
-
- const handleColumnChange = (id, selectedOption) => {
- updateFilterOptionsChanged({ ...listRowsOptions?.where_filters[id], ...{ column: selectedOption } });
- };
-
- const handleOperatorChange = (id, selectedOption) => {
- updateFilterOptionsChanged({ ...listRowsOptions?.where_filters[id], ...{ operator: selectedOption } });
- };
-
- const handleValueChange = (id, newValue) => {
- updateFilterOptionsChanged({ ...listRowsOptions?.where_filters[id], ...{ value: newValue } });
- };
return (
@@ -205,62 +261,7 @@ export const ListRows = ({ currentState, optionchanged, options, darkMode }) =>
{Object.values(listRowsOptions?.where_filters || {}).map((filter) => (
-
-
-
-
-
-
-
- handleValueChange(filter.id, newValue)}
- />
-
-
-
-
-
-
+
))}
);
-};
+});
diff --git a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/UpdateRows.jsx b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/UpdateRows.jsx
index 8b76b837d5..b7af93abc5 100644
--- a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/UpdateRows.jsx
+++ b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/UpdateRows.jsx
@@ -8,7 +8,7 @@ import { operators } from '@/TooljetDatabase/constants';
import { uniqueId } from 'lodash';
import { useMounted } from '@/_hooks/use-mount';
-export const UpdateRows = ({ currentState, optionchanged, options, darkMode }) => {
+export const UpdateRows = React.memo(({ currentState, optionchanged, options, darkMode }) => {
const { organizationId, selectedTable, columns, setColumns } = useContext(TooljetDatabaseContext);
const [updateRowsOptions, setUpdateRowsOptions] = useState(
options['update_rows'] || { columns: {}, where_filters: {} }
@@ -111,6 +111,78 @@ export const UpdateRows = ({ currentState, optionchanged, options, darkMode }) =
handleWhereFiltersChange(updatedFiltersObject);
}
+ const RenderFilterFields = ({ column, operator, value, id }) => {
+ const displayColumns = columns.map(({ accessor }) => ({
+ value: accessor,
+ label: accessor,
+ }));
+
+ const handleColumnChange = (selectedOption) => {
+ updateFilterOptionsChanged({ ...updateRowsOptions?.where_filters[id], ...{ column: selectedOption } });
+ };
+
+ const handleOperatorChange = (selectedOption) => {
+ updateFilterOptionsChanged({ ...updateRowsOptions?.where_filters[id], ...{ operator: selectedOption } });
+ };
+
+ const handleValueChange = (newValue) => {
+ updateFilterOptionsChanged({ ...updateRowsOptions?.where_filters[id], ...{ value: newValue } });
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+ handleValueChange(newValue)}
+ />
+
+
+
+
+
+
+ );
+ };
+
const RenderColumnOptions = ({ column, value, id }) => {
const filteredColumns = columns.filter(({ isPrimaryKey }) => !isPrimaryKey);
const displayColumns = filteredColumns.map(({ accessor }) => ({
@@ -190,22 +262,6 @@ export const UpdateRows = ({ currentState, optionchanged, options, darkMode }) =
);
};
- const displayColumns = columns.map(({ accessor }) => ({
- value: accessor,
- label: accessor,
- }));
-
- const handleColumnChange = (id, selectedOption) => {
- updateFilterOptionsChanged({ ...updateRowsOptions?.where_filters[id], ...{ column: selectedOption } });
- };
-
- const handleOperatorChange = (id, selectedOption) => {
- updateFilterOptionsChanged({ ...updateRowsOptions?.where_filters[id], ...{ operator: selectedOption } });
- };
-
- const handleValueChange = (id, newValue) => {
- updateFilterOptionsChanged({ ...updateRowsOptions?.where_filters[id], ...{ value: newValue } });
- };
return (
@@ -215,62 +271,7 @@ export const UpdateRows = ({ currentState, optionchanged, options, darkMode }) =
{Object.values(updateRowsOptions?.where_filters || {}).map((filter) => (
-
-
-
-
-
-
-
- handleValueChange(filter.id, newValue)}
- />
-
-
-
-
-
-
+
))}
);
-};
+});