Skip to content

Commit 5706d1d

Browse files
committed
fix(pathways): reset WhyMatch state when switching between nodes
1 parent 31a5ba5 commit 5706d1d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/registry/app/pathways/components/WhyMatch.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ export default function WhyMatch({ job, compact = false }) {
1919
const [error, setError] = useState(null);
2020
const [isExpanded, setIsExpanded] = useState(false);
2121

22-
// Check for cached insights on mount
22+
// Reset state and check for cached insights when job changes
2323
useEffect(() => {
24+
// Reset state when job changes
25+
setInsights(null);
26+
setIsLoading(false);
27+
setError(null);
28+
setIsExpanded(false);
29+
2430
if (!effectiveUserId || !job?.id) return;
2531

2632
const checkCache = async () => {

0 commit comments

Comments
 (0)