perf : deferred slide rendering + sequential loading by proximity. related to #55
All checks were successful
Deploy / Deploy to Production (push) Successful in 5m26s
All checks were successful
Deploy / Deploy to Production (push) Successful in 5m26s
Only render the active slide initially. After its critical media (videos) fires canplaythrough, progressively render remaining slides by distance. JSON loading is now sequential by proximity instead of all-parallel. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f3ce36b99c
commit
947275544d
3 changed files with 114 additions and 5 deletions
|
|
@ -76,10 +76,16 @@ async function loadSlide(path) {
|
|||
}
|
||||
}
|
||||
|
||||
function loadAllSlidesInBackground(exceptPath) {
|
||||
slides.all
|
||||
.filter((s) => s.path !== exceptPath)
|
||||
.forEach((s) => loadSlide(s.path));
|
||||
async function loadAllSlidesInBackground(exceptPath) {
|
||||
const activeIdx = slides.getIndexByPath(exceptPath)
|
||||
const remaining = slides.all
|
||||
.map((s, i) => ({ path: s.path, distance: Math.abs(i - activeIdx) }))
|
||||
.filter(s => s.path !== exceptPath)
|
||||
.sort((a, b) => a.distance - b.distance)
|
||||
|
||||
for (const { path } of remaining) {
|
||||
await loadSlide(path)
|
||||
}
|
||||
}
|
||||
|
||||
export function slideTo(path, { skipHistory = false } = {}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue