Skip to content

Commit

Permalink
fix: fixes a bug where submodule button isn't enabled when placing a …
Browse files Browse the repository at this point in the history
…module
  • Loading branch information
AssisrMatheus committed Mar 9, 2022
1 parent 7980e06 commit e573d02
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/Providers/PlannerProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ 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) => {
Expand Down Expand Up @@ -697,7 +698,8 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ 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;
Expand All @@ -724,7 +726,9 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ 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;
Expand All @@ -733,7 +737,8 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ 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) {
Expand Down

0 comments on commit e573d02

Please sign in to comment.