From ad20cab957b04254ec95a0a058c4e18c416a0db2 Mon Sep 17 00:00:00 2001 From: Kevin Nguyen Date: Fri, 20 Dec 2024 14:41:35 -0600 Subject: [PATCH] fix(RV-431): Fix multiple page uniqueness for fields --- frontend/src/pages/AnnotateTemplate.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/AnnotateTemplate.tsx b/frontend/src/pages/AnnotateTemplate.tsx index 818f3884..ad9ecd50 100644 --- a/frontend/src/pages/AnnotateTemplate.tsx +++ b/frontend/src/pages/AnnotateTemplate.tsx @@ -143,8 +143,15 @@ const AnnotateTemplate: React.FC = () => { color: item.color.slice(0, 7), }); const tempFields = [...fields]; + // get all fields for all indexes and + const uniqueFields = new Set(); + fields.forEach((field) => { + field.forEach((f) => { + uniqueFields.add(f); + }); + }); const tempMap = new Map(localIds); - if (!tempFields[index].has(item.name)) { + if (!tempFields[index].has(item.name) && !uniqueFields.has(item.name)) { annotator!.drawRectangle(); tempFields[index].add(item.name); tempMap.set( @@ -207,7 +214,6 @@ const AnnotateTemplate: React.FC = () => { navigate("/new-template/upload")} - onSubmit={handleSubmit} />