From 761d0c6e2b436f34b85ae4e0ee0ddb9f2032af4e Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Mon, 4 Mar 2024 12:09:50 -0300 Subject: [PATCH 1/2] always sort tags by orderWeight --- src/libs/PolicyUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 70f87a8c7373..0a8560fa011c 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -181,7 +181,8 @@ function getTagLists(policyTagList: OnyxEntry): Array policyTagListValue !== null); + return Object.values(policyTagList).filter((policyTagListValue) => policyTagListValue !== null) + .sort((tagA, tagB) => tagA.orderWeight - tagB.orderWeight); } /** From 49582a51b472b16a234bda052a9b330a75936707 Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Mon, 4 Mar 2024 12:25:03 -0300 Subject: [PATCH 2/2] prettier --- src/libs/PolicyUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 0a8560fa011c..5b916148c6ee 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -181,7 +181,8 @@ function getTagLists(policyTagList: OnyxEntry): Array policyTagListValue !== null) + return Object.values(policyTagList) + .filter((policyTagListValue) => policyTagListValue !== null) .sort((tagA, tagB) => tagA.orderWeight - tagB.orderWeight); }