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: resume undefined issue

Khuram Niazdbe01a91ede0
diff --git a/src/components/profile/AddResumeSection.tsx b/src/components/profile/AddResumeSection.tsx
index 0d2ee0e..886b21b 100644
--- a/src/components/profile/AddResumeSection.tsx
+++ b/src/components/profile/AddResumeSection.tsx
@@ -64,20 +64,19 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(
setEducationToEdit({ ...educationSection });
},
}));
- const summarySection = resume.ResumeSections?.find(
+ const summarySection = resume?.ResumeSections?.find(
(section) => section.sectionType === SectionType.SUMMARY
);
- const experienceSection = resume.ResumeSections?.find(
+ const experienceSection = resume?.ResumeSections?.find(
(section) => section.sectionType === SectionType.EXPERIENCE
);
- const educationSection = resume.ResumeSections?.find(
+ const educationSection = resume?.ResumeSections?.find(
(section) => section.sectionType === SectionType.EDUCATION
);
const resetExperienceToEdit = () => {
setExperienceToEdit(null);
};
const resetEducationToEdit = () => {
- console.log("RESET EDUCTION TO EDIT");
setEducationToEdit(null);
};
return (
@@ -96,7 +95,7 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(
<DropdownMenuItem
className="cursor-pointer"
onClick={() => setContactInfoDialogOpen(true)}
- disabled={!!resume.ContactInfo}
+ disabled={!!resume?.ContactInfo}
>
Add Contact Info
</DropdownMenuItem>
@@ -123,19 +122,19 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(
</DropdownMenuContent>
</DropdownMenu>
<AddContactInfo
- resumeId={resume.id}
+ resumeId={resume?.id}
dialogOpen={contactInfoDialogOpen}
setDialogOpen={setContactInfoDialogOpen}
contactInfoToEdit={contactInfoToEdit}
/>
<AddResumeSummary
- resumeId={resume.id}
+ resumeId={resume?.id}
dialogOpen={summaryDialogOpen}
setDialogOpen={setSummaryDialogOpen}
summaryToEdit={summaryToEdit}
/>
<AddExperience
- resumeId={resume.id}
+ resumeId={resume?.id}
sectionId={experienceSection?.id}
dialogOpen={experienceDialogOpen}
setDialogOpen={setExperienceDialogOpen}
@@ -143,7 +142,7 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(
resetExperienceToEdit={resetExperienceToEdit}
/>
<AddEducation
- resumeId={resume.id}
+ resumeId={resume?.id}
sectionId={educationSection?.id}
dialogOpen={educationDialogOpen}
setDialogOpen={setEducationDialogOpen}
diff --git a/src/components/profile/ResumeContainer.tsx b/src/components/profile/ResumeContainer.tsx
index 3bf5e49..7084403 100644
--- a/src/components/profile/ResumeContainer.tsx
+++ b/src/components/profile/ResumeContainer.tsx
@@ -10,17 +10,17 @@ import EducationCard from "./EducationCard";
function ResumeContainer({ resume }: { resume: Resume }) {
const resumeSectionRef = useRef<AddResumeSectionRef>(null);
- const summarySection = resume.ResumeSections?.find(
+ const summarySection = resume?.ResumeSections?.find(
(section) => section.sectionType === SectionType.SUMMARY
);
- const experienceSection = resume.ResumeSections?.find(
+ const experienceSection = resume?.ResumeSections?.find(
(section) => section.sectionType === SectionType.EXPERIENCE
);
- const educationSection = resume.ResumeSections?.find(
+ const educationSection = resume?.ResumeSections?.find(
(section) => section.sectionType === SectionType.EDUCATION
);
const openContactInfoDialog = () => {
- resumeSectionRef.current?.openContactInfoDialog(resume.ContactInfo!);
+ resumeSectionRef.current?.openContactInfoDialog(resume?.ContactInfo!);
};
const openSummaryDialogForEdit = () => {
resumeSectionRef.current?.openSummaryDialog(summarySection!);
@@ -48,13 +48,13 @@ function ResumeContainer({ resume }: { resume: Resume }) {
<Card>
<CardHeader className="flex-row justify-between items-center">
<CardTitle>Resume</CardTitle>
- <CardDescription>{resume.title}</CardDescription>
+ <CardDescription>{resume?.title}</CardDescription>
<div className="flex items-center">
<AddResumeSection resume={resume} ref={resumeSectionRef} />
</div>
</CardHeader>
</Card>
- {resume.ContactInfo ? (
+ {resume?.ContactInfo ? (
<ContactInfoCard
contactInfo={resume.ContactInfo}
openDialog={openContactInfoDialog}