From 70975a61c10e009ee8a1e7d521b7ec3b7dc4382d Mon Sep 17 00:00:00 2001
From: Robert Sesek <rsesek@bluestatic.org>
Date: Thu, 8 Apr 2021 22:45:25 -0400
Subject: [PATCH] If forms in the select viewer have the same name, append a
 counter.

---
 src/TaxReturnView.tsx | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/TaxReturnView.tsx b/src/TaxReturnView.tsx
index 27d8810..1576e61 100644
--- a/src/TaxReturnView.tsx
+++ b/src/TaxReturnView.tsx
@@ -31,6 +31,7 @@ export default function TaxReturnView(props: Props) {
   };
 
   const formIndexToName = createMemo(() => {
+    const formNameCounts = {};
     let forms = props.tr.forms.map((form, i) => {
       let name = form.name;
       const person = form.person();
@@ -38,6 +39,12 @@ export default function TaxReturnView(props: Props) {
         const personName = person === Person.joint ? 'Joint' : person.name;
         name += ` (${personName})`;
       }
+      if (name in formNameCounts) {
+        formNameCounts[name] += 1;
+        name += ` (${formNameCounts[name]})`;
+      } else {
+        formNameCounts[name] = 1;
+      }
       return [i, name];
     });
     forms.sort((a, b) => {
-- 
2.43.5