Skip to content

Commit

Permalink
add the day and week budget hours in checkSchedule effect dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaybadgujar102 committed Nov 9, 2024
1 parent 2c5be17 commit a0aae54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/components/GoalsComponents/GoalConfigModal/ConfigGoal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,13 @@ const ConfigGoal = ({ type, goal, mode }: { type: TGoalCategory; mode: TGoalConf

const checkSchedule = async () => {
setScheduleStatus("pending");
const schedulerOutput = await checkGoalSchedule(getFinalTags());
console.log("schedulerOutput", schedulerOutput);
const status = await checkSchedulingStatus(schedulerOutput, goal.id);
console.log("status", status);
setScheduleStatus(status);
try {
const schedulerOutput = await checkGoalSchedule(getFinalTags());
const status = await checkSchedulingStatus(schedulerOutput, goal.id);
setScheduleStatus(status);
} catch (error) {
setScheduleStatus(null);
}
};

useEffect(() => {
Expand All @@ -327,7 +329,7 @@ const ConfigGoal = ({ type, goal, mode }: { type: TGoalCategory; mode: TGoalConf
}, 1000);

return () => clearTimeout(debounceTimer);
}, [tags.duration, afterTime, beforeTime, tags.on]);
}, [tags.duration, afterTime, beforeTime, perDayHrs, perWeekHrs]);

return (
<ZModal
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useScheduler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function useScheduler() {
return res;
} catch (error) {
console.log("Error checking goal schedule:", error);
return undefined;
return null;
}
};

Expand Down

0 comments on commit a0aae54

Please sign in to comment.