feat(ux): implement incremental loading and edge-to-edge scrolling

This commit is contained in:
Shivansh Gupta
2026-03-05 00:09:23 +05:30
parent 44860d5f7b
commit 3f35844ec9
8 changed files with 215 additions and 78 deletions

View File

@@ -22,7 +22,14 @@ export function SkillProvider({ children }: { children: React.ReactNode }) {
// Fetch skills index
const res = await fetch('/skills.json');
const data = await res.json();
setSkills(data);
// Incremental loading: set first 50 skills immediately if not a silent refresh
if (!silent && data.length > 50) {
setSkills(data.slice(0, 50));
setLoading(false); // Clear loading state as soon as we have initial content
} else {
setSkills(data);
}
// Fetch stars from Supabase if available
if (supabase) {
@@ -38,6 +45,14 @@ export function SkillProvider({ children }: { children: React.ReactNode }) {
setStars(starMap);
}
}
// Finally set the full set of skills if we did incremental load
if (!silent && data.length > 50) {
setSkills(data);
} else if (silent) {
setSkills(data);
}
} catch (err) {
console.error('SkillContext: Failed to load skills', err);
} finally {