From ca065c29d217aa70cb0009674c972fd56e35c29e Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Tue, 21 Jan 2025 08:25:24 +0100 Subject: [PATCH] fix: enhance logic --- frontend/src/components/categories/index.tsx | 6 +++--- frontend/src/components/context-vars/index.tsx | 6 +++--- frontend/src/components/nlp/components/NlpEntity.tsx | 6 +++--- frontend/src/components/nlp/components/NlpSample.tsx | 6 +++--- frontend/src/components/nlp/components/NlpValues.tsx | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/categories/index.tsx b/frontend/src/components/categories/index.tsx index 21ec4c33..9c29e417 100644 --- a/frontend/src/components/categories/index.tsx +++ b/frontend/src/components/categories/index.tsx @@ -123,7 +123,7 @@ export const Categories = () => { actionColumns, ]; const handleSelectionChange = (selection: GridRowSelectionModel) => - deleteDialogCtl.saveData?.(selection as string[]); + deleteDialogCtl.setData?.(selection as string[]); return ( @@ -158,7 +158,7 @@ export const Categories = () => { ) : null} - {deleteDialogCtl?.data?.length && ( + {deleteDialogCtl.data?.length ? ( - )} + ) : null} diff --git a/frontend/src/components/context-vars/index.tsx b/frontend/src/components/context-vars/index.tsx index 57932475..501552d8 100644 --- a/frontend/src/components/context-vars/index.tsx +++ b/frontend/src/components/context-vars/index.tsx @@ -158,7 +158,7 @@ export const ContextVars = () => { actionColumns, ]; const handleSelectionChange = (selection: GridRowSelectionModel) => - deleteDialogCtl.saveData?.(selection as string[]); + deleteDialogCtl.setData?.(selection as string[]); return ( @@ -193,7 +193,7 @@ export const ContextVars = () => { ) : null} - {deleteDialogCtl?.data?.length && ( + {deleteDialogCtl.data?.length ? ( - )} + ) : null} diff --git a/frontend/src/components/nlp/components/NlpEntity.tsx b/frontend/src/components/nlp/components/NlpEntity.tsx index a87df46f..a906dcf4 100644 --- a/frontend/src/components/nlp/components/NlpEntity.tsx +++ b/frontend/src/components/nlp/components/NlpEntity.tsx @@ -170,7 +170,7 @@ const NlpEntity = () => { actionEntityColumns, ]; const handleSelectionChange = (selection: GridRowSelectionModel) => - deleteDialogCtl.saveData?.(selection as string[]); + deleteDialogCtl.setData?.(selection as string[]); return ( @@ -202,7 +202,7 @@ const NlpEntity = () => { ) : null} - {deleteDialogCtl?.data?.length && ( + {deleteDialogCtl.data?.length ? ( - )} + ) : null} - deleteDialogCtl.saveData?.(selection as string[]); + deleteDialogCtl.setData?.(selection as string[]); const handleImportChange = async (file: File) => { await importDataset(file); }; @@ -396,7 +396,7 @@ export default function NlpSample() { {t("button.export")} ) : null} - {deleteDialogCtl.data && ( + {deleteDialogCtl.data?.length ? ( - )} + ) : null} diff --git a/frontend/src/components/nlp/components/NlpValues.tsx b/frontend/src/components/nlp/components/NlpValues.tsx index 6e0e2d1f..dad1fe8f 100644 --- a/frontend/src/components/nlp/components/NlpValues.tsx +++ b/frontend/src/components/nlp/components/NlpValues.tsx @@ -151,7 +151,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => { const canHaveSynonyms = nlpEntity?.lookups?.[0] === NlpLookups.keywords; const handleSelectionChange = (selection: GridRowSelectionModel) => - deleteDialogCtl.saveData?.(selection as string[]); + deleteDialogCtl.setData?.(selection as string[]); return ( @@ -202,7 +202,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => { {t("button.add")} ) : null} - {deleteDialogCtl?.data?.length && ( + {deleteDialogCtl.data?.length ? ( - )} + ) : null}