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: stop job match streaming error

Khuram Niaz1c371fec7953
diff --git a/src/components/automations/MatchDetails.tsx b/src/components/automations/MatchDetails.tsx
index 7cf6766..b3a2b99 100644
--- a/src/components/automations/MatchDetails.tsx
+++ b/src/components/automations/MatchDetails.tsx
@@ -43,7 +43,7 @@ export function MatchDetails({ matchData, discoveredAt }: MatchDetailsProps) {
<AccordionTrigger>Skills Analysis</AccordionTrigger>
<AccordionContent>
<div className="space-y-3">
- {matchData.skills.matched.length > 0 && (
+ {matchData.skills?.matched?.length > 0 && (
<div>
<h5 className="text-sm font-medium text-green-600">Matched Skills</h5>
<div className="flex flex-wrap gap-1 mt-1">
@@ -55,7 +55,7 @@ export function MatchDetails({ matchData, discoveredAt }: MatchDetailsProps) {
</div>
</div>
)}
- {matchData.skills.missing.length > 0 && (
+ {matchData.skills?.missing?.length > 0 && (
<div>
<h5 className="text-sm font-medium text-amber-600">Missing Skills</h5>
<div className="flex flex-wrap gap-1 mt-1">
@@ -67,7 +67,7 @@ export function MatchDetails({ matchData, discoveredAt }: MatchDetailsProps) {
</div>
</div>
)}
- {matchData.skills.transferable.length > 0 && (
+ {matchData.skills?.transferable?.length > 0 && (
<div>
<h5 className="text-sm font-medium text-blue-600">Transferable Skills</h5>
<div className="flex flex-wrap gap-1 mt-1">
@@ -87,7 +87,7 @@ export function MatchDetails({ matchData, discoveredAt }: MatchDetailsProps) {
<AccordionTrigger>Requirements Analysis</AccordionTrigger>
<AccordionContent>
<div className="space-y-3">
- {matchData.requirements.met.length > 0 && (
+ {matchData.requirements?.met?.length > 0 && (
<div>
<h5 className="text-sm font-medium text-green-600">Met Requirements</h5>
<ul className="text-sm mt-1 space-y-1">
@@ -100,7 +100,7 @@ export function MatchDetails({ matchData, discoveredAt }: MatchDetailsProps) {
</ul>
</div>
)}
- {matchData.requirements.missing.length > 0 && (
+ {matchData.requirements?.missing?.length > 0 && (
<div>
<h5 className="text-sm font-medium text-red-600">Missing Requirements</h5>
<ul className="text-sm mt-1 space-y-1">
@@ -117,7 +117,7 @@ export function MatchDetails({ matchData, discoveredAt }: MatchDetailsProps) {
</AccordionContent>
</AccordionItem>
- {matchData.tailoringTips.length > 0 && (
+ {matchData.tailoringTips?.length > 0 && (
<AccordionItem value="tips">
<AccordionTrigger>Tailoring Tips</AccordionTrigger>
<AccordionContent>
@@ -133,7 +133,7 @@ export function MatchDetails({ matchData, discoveredAt }: MatchDetailsProps) {
</AccordionItem>
)}
- {matchData.dealBreakers.length > 0 && (
+ {matchData.dealBreakers?.length > 0 && (
<AccordionItem value="dealbreakers">
<AccordionTrigger>Potential Deal Breakers</AccordionTrigger>
<AccordionContent>
diff --git a/src/components/profile/AiJobMatchSection.tsx b/src/components/profile/AiJobMatchSection.tsx
index c25444c..a096b2b 100644
--- a/src/components/profile/AiJobMatchSection.tsx
+++ b/src/components/profile/AiJobMatchSection.tsx
@@ -55,6 +55,7 @@ export const AiJobMatchSection = ({
const [isLoadingSettings, setIsLoadingSettings] = useState(true);
const resumesRef = useRef<Resume[]>([]);
const wasLoadingRef = useRef(false);
+ const stoppedByUserRef = useRef(false);
useEffect(() => {
const fetchSettings = async () => {
@@ -96,6 +97,10 @@ export const AiJobMatchSection = ({
}
if (!wasLoadingRef.current || !object?.matchScore) return;
wasLoadingRef.current = false;
+ if (stoppedByUserRef.current) {
+ stoppedByUserRef.current = false;
+ return;
+ }
const resumeTitle =
resumesRef.current.find((r) => r.id === selectedResumeId)?.title ??
@@ -162,6 +167,7 @@ export const AiJobMatchSection = ({
const onOpenChange = async (openState: boolean) => {
triggerChange(openState);
if (!openState && isLoading) {
+ stoppedByUserRef.current = true;
stop();
}
if (openState && selectedModel.provider === "ollama") {