From d31ce82d7816bf29646c7bb1685c65572e37fbd9 Mon Sep 17 00:00:00 2001 From: Pavel Kirilin Date: Sun, 27 Oct 2024 23:28:54 +0300 Subject: [PATCH] Prevent duplicate recognize request after product discarded --- src/frontend/src/features/addNote/model/addNoteSlice.ts | 1 + src/frontend/src/features/addNote/ui/SearchProductsOnImage.tsx | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/features/addNote/model/addNoteSlice.ts b/src/frontend/src/features/addNote/model/addNoteSlice.ts index 01625a3ea..dc3f2993f 100644 --- a/src/frontend/src/features/addNote/model/addNoteSlice.ts +++ b/src/frontend/src/features/addNote/model/addNoteSlice.ts @@ -55,6 +55,7 @@ export const addNoteSlice = createSlice({ if (state.note) { state.note.product = null; delete state.product; + delete state.image; } }, diff --git a/src/frontend/src/features/addNote/ui/SearchProductsOnImage.tsx b/src/frontend/src/features/addNote/ui/SearchProductsOnImage.tsx index 9cca31718..395e9e812 100644 --- a/src/frontend/src/features/addNote/ui/SearchProductsOnImage.tsx +++ b/src/frontend/src/features/addNote/ui/SearchProductsOnImage.tsx @@ -32,7 +32,6 @@ export const SearchProductsOnImage: FC = ({ image }) => { }, [image.base64, image.name, recognize]); useEffect(() => { - // TODO: prevent duplicate request after product discarded sendRecognizeRequest(); }, [sendRecognizeRequest]);