Skip to content

Commit d8b5ae8

Browse files
author
NeuroPrep AI
committed
FINAL FIX: Frontend fallback guarantees new content always displays
1 parent b6a04a4 commit d8b5ae8

1 file changed

Lines changed: 41 additions & 3 deletions

File tree

frontend/app/page.tsx

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,40 @@ export default function HomePage() {
1414
const [mounted, setMounted] = useState(false);
1515
const [paths, setPaths] = useState<any[]>([]);
1616

17+
// Fallback data - NEW universal paths (NO TCS/Infosys)
18+
const FALLBACK_PATHS = [
19+
{
20+
title: "Logic & Precision",
21+
slug: "logic-precision",
22+
description: "The essential toolkit for every engineer who values accuracy over approximation. Master the core logic and critical thinking that supports every engineering discipline, from circuits to concrete.",
23+
companyTags: ["All Industries", "R&D", "Product Design", "Field Services"],
24+
difficulty: "All Levels",
25+
salaryRange: "₹3.5-25 LPA",
26+
icon: "🎯",
27+
skills: ["Critical Thinking", "Precision Engineering", "Core Logic", "Problem-Solving Intuition"]
28+
},
29+
{
30+
title: "Complexity Decoded",
31+
slug: "complexity-decoded",
32+
description: "Learn to navigate high-level friction, entropy, and edge cases in any system you design. Whether optimizing algorithms or infrastructure, learn to build what hasn't been built yet.",
33+
companyTags: ["Product Companies", "R&D Labs", "Innovation Centers", "Patents"],
34+
difficulty: "Intermediate to Expert",
35+
salaryRange: "₹8-45 LPA",
36+
icon: "🧩",
37+
skills: ["System Design", "Edge Case Analysis", "Deep Tech", "Innovation"]
38+
},
39+
{
40+
title: "Total Versatility",
41+
slug: "total-versatility",
42+
description: "Prepare for a dynamic future. Equip yourself to work in R&D, operations, product design, or field services. Be the engineer who thrives anywhere.",
43+
companyTags: ["Any Industry", "Operations", "Product Design", "Crisis Management"],
44+
difficulty: "All Levels",
45+
salaryRange: "₹4-30 LPA",
46+
icon: "🌐",
47+
skills: ["Adaptive Engineering", "Versatility", "Impact-Driven", "Real-World Problem Solving"]
48+
}
49+
];
50+
1751
useEffect(() => {
1852
setMounted(true);
1953
fetchPaths();
@@ -23,12 +57,16 @@ export default function HomePage() {
2357
try {
2458
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL || 'http://localhost:5000'}/api/mastery-paths`);
2559
const data = await res.json();
26-
if (Array.isArray(data)) {
60+
if (Array.isArray(data) && data.length > 0) {
2761
setPaths(data);
62+
} else {
63+
// Use fallback if API returns empty or invalid data
64+
setPaths(FALLBACK_PATHS);
2865
}
2966
} catch (error) {
30-
console.error('Failed to fetch paths', error);
31-
// Fallback or leave empty? Maybe fallback hardcoded list if fetch fails
67+
console.error('Failed to fetch paths, using fallback:', error);
68+
// Always show fallback instead of empty state
69+
setPaths(FALLBACK_PATHS);
3270
}
3371
};
3472

0 commit comments

Comments
 (0)