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.

Optimize performance, reduce unnecessary fetch

Khuram Niaz394880ea94f0
diff --git a/src/components/myjobs/AddJob.tsx b/src/components/myjobs/AddJob.tsx
index ef518f6..c0ce05e 100644
--- a/src/components/myjobs/AddJob.tsx
+++ b/src/components/myjobs/AddJob.tsx
@@ -147,9 +147,10 @@ export function AddJob({
}, [editJob, reset]);
useEffect(() => {
+ if (!dialogOpen) return;
loadResumes();
loadCoverLetters();
- }, [loadResumes, loadCoverLetters]);
+ }, [dialogOpen, loadResumes, loadCoverLetters]);
const setNewResumeId = (id: string) => {
setTimeout(() => {
diff --git a/src/components/profile/AddEducation.tsx b/src/components/profile/AddEducation.tsx
index 98cac7e..266fa52 100644
--- a/src/components/profile/AddEducation.tsx
+++ b/src/components/profile/AddEducation.tsx
@@ -70,6 +70,7 @@ function AddEducation({
const degreeCompletedValue = watch("degreeCompleted");
useEffect(() => {
+ if (!dialogOpen) return;
getLocationData();
if (educationToEdit) {
const education: Education = educationToEdit?.educations?.at(0)!;
@@ -85,7 +86,7 @@ function AddEducation({
description: education?.description,
degreeCompleted: !!education?.endDate,
},
- { keepDefaultValues: true }
+ { keepDefaultValues: true },
);
} else {
reset(
@@ -93,10 +94,17 @@ function AddEducation({
resumeId,
sectionId,
},
- { keepDefaultValues: true }
+ { keepDefaultValues: true },
);
}
- }, [getLocationData, educationToEdit, resumeId, sectionId, reset]);
+ }, [
+ dialogOpen,
+ getLocationData,
+ educationToEdit,
+ resumeId,
+ sectionId,
+ reset,
+ ]);
const onDegreeCompleted = (completed: boolean) => {
if (completed) {
diff --git a/src/components/profile/AddExperience.tsx b/src/components/profile/AddExperience.tsx
index 2565621..b856867 100644
--- a/src/components/profile/AddExperience.tsx
+++ b/src/components/profile/AddExperience.tsx
@@ -78,6 +78,7 @@ function AddExperience({
const currentJobValue = watch("currentJob");
useEffect(() => {
+ if (!dialogOpen) return;
getTitleCompanyAndLocationData();
if (experienceToEdit) {
const experience: WorkExperience =
@@ -95,7 +96,7 @@ function AddExperience({
},
{
keepDefaultValues: true,
- }
+ },
);
} else {
reset(
@@ -103,10 +104,11 @@ function AddExperience({
resumeId,
sectionId,
},
- { keepDefaultValues: true }
+ { keepDefaultValues: true },
);
}
}, [
+ dialogOpen,
getTitleCompanyAndLocationData,
experienceToEdit,
reset,
diff --git a/src/components/profile/AiResumeReviewSection.tsx b/src/components/profile/AiResumeReviewSection.tsx
index 71b63ad..5de164a 100644
--- a/src/components/profile/AiResumeReviewSection.tsx
+++ b/src/components/profile/AiResumeReviewSection.tsx
@@ -41,6 +41,7 @@ const AiResumeReviewSection = ({ resume }: AiSectionProps) => {
const [isLoadingSettings, setIsLoadingSettings] = useState(true);
useEffect(() => {
+ if (!aISectionOpen) return;
const fetchSettings = async () => {
try {
const result = await getUserSettings();
@@ -58,7 +59,7 @@ const AiResumeReviewSection = ({ resume }: AiSectionProps) => {
}
};
fetchSettings();
- }, []);
+ }, [aISectionOpen]);
// Standard single-agent mode
const { object, submit, isLoading, stop } = useObject({
@@ -108,7 +109,8 @@ const AiResumeReviewSection = ({ resume }: AiSectionProps) => {
};
// Check if we have any content to show
- const hasContent = object && (object.scores?.overall !== undefined || object.summary);
+ const hasContent =
+ object && (object.scores?.overall !== undefined || object.summary);
const showSlowWarning = useSlowResponseWarning(isLoading, !!hasContent);
@@ -121,7 +123,11 @@ const AiResumeReviewSection = ({ resume }: AiSectionProps) => {
variant="outline"
className="h-8 gap-1 cursor-pointer"
onClick={() => triggerSheetChange(true)}
- disabled={isLoading || isLoadingSettings || resume.ResumeSections?.length! < 2}
+ disabled={
+ isLoading ||
+ isLoadingSettings ||
+ resume.ResumeSections?.length! < 2
+ }
>
<Sparkles className="h-3.5 w-3.5" />
<span className="sr-only sm:not-sr-only sm:whitespace-nowrap">
@@ -174,7 +180,8 @@ const AiResumeReviewSection = ({ resume }: AiSectionProps) => {
onClick={getResumeReview}
disabled={
isLoading ||
- (selectedModel.provider === "ollama" && ollamaConnected === false)
+ (selectedModel.provider === "ollama" &&
+ ollamaConnected === false)
}
>
<Sparkles className="h-3.5 w-3.5" />