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.
This commit is contained in:
anovazzi1 2023-06-16 18:20:06 -03:00
commit e1e5fb14c9

View file

@ -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.