Skip to content

Commit

Permalink
fix: fixes loading when downloading modules
Browse files Browse the repository at this point in the history
  • Loading branch information
AssisrMatheus committed Mar 9, 2022
1 parent 4469d35 commit c962c82
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/Providers/PlannerProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ children, proj

const createModule = useCallback(
(module: ModuleDataFragment, rulesJson: Record<string, unknown>) => {
// setIsPending(true);
setIsPending(true);

const parentNanoId = nanoid();
const moduleJson = {
Expand Down Expand Up @@ -300,12 +300,12 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ children, proj

unityInstance.current?.SendMessage(UNITY_GAME_OBJECT, 'CreateModule', json);
},
[unityInstance]
[unityInstance, setIsPending]
);

const createChildrenModule = useCallback(
(module: ModuleDataFragment, rulesJson: Record<string, unknown>) => {
// setIsPending(true);
setIsPending(true);

const moduleJson = {
nanoId: nanoid(),
Expand All @@ -320,7 +320,7 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ children, proj

unityInstance.current?.SendMessage(UNITY_GAME_OBJECT, 'CreateChildrenModule', json);
},
[unityInstance, projectModule]
[unityInstance, projectModule, setIsPending]
);

const setupDrawer = useCallback(
Expand Down Expand Up @@ -655,7 +655,7 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ children, proj

console.log('createModule: ', projectModule, childrenModules);

// setIsPending(false);
setIsPending(false);
setProjectModule((prevProjectModule) => updateProjectModuleState(projectModule, prevProjectModule));
setChildrenModules(childrenModules?.children);
setState('Created');
Expand All @@ -672,7 +672,7 @@ export const PlannerProvider: React.FC<PlannerProviderProps> = ({ children, proj

console.log('selectedModule: ', projectModule, childrenModules);

// setIsPending(false);
setIsPending(false);
setProjectModule((prevProjectModule) => updateProjectModuleState(projectModule, prevProjectModule));
setChildrenModules(childrenModules?.children);
setState('Selected');
Expand Down

0 comments on commit c962c82

Please sign in to comment.