Skip to content

Commit

Permalink
Fixed toast issue + fixed invalidation of assumption and formula
Browse files Browse the repository at this point in the history
  • Loading branch information
nipunarora-eGov committed Dec 2, 2024
1 parent cff5b4b commit acd36ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ const HypothesisWrapper = ({ onSelect, props: customProps }) => {
{
enabled: microplanId ? true : false,
cacheTime: 0,
// queryKey: currentKey,
staleTime:0,
refetchOnMount: true,
queryKey:state?.allAssumptions ? state?.allAssumptions.length : "hypothesis_plan"
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,17 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => {
setCurrentStep(Number(filteredConfig?.[0]?.form?.[0]?.stepCount - 1));
// setting the toast to null when moving to next step successfully
// if any issue comes related to Toast, update here
setShowToast(null);
// setShowToast(null);
// this null was causing toast to immediatealy go to null since filteredConfig gets affected
}, [currentKey, filteredConfig]);

useEffect(() => {
// setting the toast to null when moving to next step successfully
// if any issue comes related to Toast, update here
setShowToast(null)
}, [currentKey])


useEffect(() => {
setIsSubmitting(false);
Digit.Utils.microplanv1.updateUrlParams({ key: currentKey });
Expand All @@ -179,7 +187,8 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => {
onSuccess: (data) => {
// Check if there is a redirectTo property in the response
if (data?.redirectTo) {
history.push(data?.redirectTo, data?.state); // Navigate to the specified route
history.push(data?.redirectTo, data?.state);
return; // Navigate to the specified route
}

//invalidation of files session
Expand Down Expand Up @@ -218,8 +227,10 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => {
Digit.SessionStorage.del("HYPOTHESIS_DATA");
Digit.SessionStorage.del("FORMULA_DATA");


setCurrentKey((prev) => prev + 1);
setCurrentStep((prev) => prev + 1);


//since we are invalidating we need to update this global state
dispatch({
Expand Down

0 comments on commit acd36ce

Please sign in to comment.