From e573d0240bd4632fbe6838b9908837f1dbf58023 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Wed, 9 Mar 2022 15:00:11 -0300 Subject: [PATCH] fix: fixes a bug where submodule button isn't enabled when placing a module --- src/components/Providers/PlannerProvider/index.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/Providers/PlannerProvider/index.tsx b/src/components/Providers/PlannerProvider/index.tsx index 7cf6e6c..cac374f 100644 --- a/src/components/Providers/PlannerProvider/index.tsx +++ b/src/components/Providers/PlannerProvider/index.tsx @@ -661,7 +661,8 @@ export const PlannerProvider: React.FC = ({ children, proj setState('Created'); if (projectModule.module.isMat) { - await handleUpsertProjectModule(projectModule, []); + // Purposefully do not await as we don't need it as dependency of anything + handleUpsertProjectModule(projectModule, []); } }, selectedModule: (projectModuleJson: string, childrenJson?: string) => { @@ -697,7 +698,8 @@ export const PlannerProvider: React.FC = ({ children, proj // Using this because putting the variable on the dependencies make the entire code not run. if (!projectModule.module.isMat && shouldCreateOrUpdate.current) { - await handleUpsertProjectModule(projectModule, childrenModules?.children || []); + // Purposefully do not await as we don't need it as dependency of anything + handleUpsertProjectModule(projectModule, childrenModules?.children || []); setProjectModule(undefined); setChildrenModules(undefined); shouldCreateOrUpdate.current = false; @@ -724,7 +726,9 @@ export const PlannerProvider: React.FC = ({ children, proj (x) => x.id !== projectModule.id || (childrenModules?.children || []).some((y) => y.id === x.id) ) ); - await handleDeleteProjectModule(projectModule, childrenModules?.children); + + // Purposefully do not await as we don't need it as dependency of anything + handleDeleteProjectModule(projectModule, childrenModules?.children); }, recalculatedExtensions: async (projectModuleJson: string, childrenJson: string) => { if (!finishedSetup) return; @@ -733,7 +737,8 @@ export const PlannerProvider: React.FC = ({ children, proj console.log('recalculatedExtensions: ', projectModule, childrenModules); - await handleUpsertProjectModule(projectModule, childrenModules.children); + // Purposefully do not await as we don't need it as dependency of anything + handleUpsertProjectModule(projectModule, childrenModules.children); }, unityReady: () => { if (!finishedSetup) {