Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

fix: revalidate dashboard path after activity and job actions

Khuram Niaz3383773a7bb9
diff --git a/src/actions/activity.actions.ts b/src/actions/activity.actions.ts
index 5803a0a..e026879 100644
--- a/src/actions/activity.actions.ts
+++ b/src/actions/activity.actions.ts
@@ -6,6 +6,7 @@ import { AddActivityFormSchema } from "@/models/addActivityForm.schema";
import { getCurrentUser } from "@/utils/user.utils";
import { APP_CONSTANTS } from "@/lib/constants";
import { z } from "zod";
+import { revalidatePath } from "next/cache";
export const getAllActivityTypes = async (): Promise<any | undefined> => {
try {
@@ -147,6 +148,7 @@ export const createActivity = async (
description,
},
});
+ revalidatePath("/dashboard");
return { activity, success: true };
} catch (error) {
const msg = "Failed to create activity. ";
@@ -170,6 +172,7 @@ export const deleteActivityById = async (
userId: user.id,
},
});
+ revalidatePath("/dashboard");
return { res, success: true };
} catch (error) {
const msg = "Failed to delete job.";
@@ -262,6 +265,7 @@ export const stopActivityById = async (
duration,
},
});
+ revalidatePath("/dashboard");
return { activity, success: true };
} catch (error) {
const msg = "Failed to stop activity. ";
diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.ts
index 5a9bb25..fab0c15 100644
--- a/src/actions/job.actions.ts
+++ b/src/actions/job.actions.ts
@@ -356,6 +356,7 @@ export const addJob = async (
: {}),
},
});
+ revalidatePath("/dashboard");
return { job, success: true };
} catch (error) {
const msg = "Failed to create job. ";
@@ -421,7 +422,7 @@ export const updateJob = async (
tags: { set: tagIds.map((id) => ({ id })) },
},
});
- // revalidatePath("/dashboard/myjobs", "page");
+ revalidatePath("/dashboard");
return { job, success: true };
} catch (error) {
const msg = "Failed to update job. ";
@@ -466,6 +467,7 @@ export const updateJobStatus = async (
},
data: dataToUpdate(),
});
+ revalidatePath("/dashboard");
return { job, success: true };
} catch (error) {
const msg = "Failed to update job status.";
@@ -512,6 +514,7 @@ export const deleteJobById = async (
userId: user.id,
},
});
+ revalidatePath("/dashboard");
return { res, success: true };
} catch (error) {
const msg = "Failed to delete job.";