From e1e5fb14c9a5552ec65f891db2b3348913cd21ec Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 16 Jun 2023 18:20:06 -0300 Subject: [PATCH] refactor(typesContext.tsx): reverse the order of keys in the types object to avoid overlap with tool world The keys in the types object were reversed to avoid overlap with the tool world. This was done by modifying the reduce function in the TypesProvider component. --- src/frontend/src/contexts/typesContext.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/contexts/typesContext.tsx b/src/frontend/src/contexts/typesContext.tsx index aed6e3375..8db48fbf0 100644 --- a/src/frontend/src/contexts/typesContext.tsx +++ b/src/frontend/src/contexts/typesContext.tsx @@ -51,7 +51,8 @@ export function TypesProvider({ children }: { children: ReactNode }) { ); // Set the types by reducing over the keys of the result data and updating the accumulator. setTypes( - Object.keys(result.data).reduce((acc, curr) => { + // Reverse the keys so the tool world does not overlap + Object.keys(result.data).reverse().reduce((acc, curr) => { Object.keys(result.data[curr]).forEach((c: keyof APIKindType) => { acc[c] = curr; // Add the base classes to the accumulator as well.