posit-dev / posit-dev/open-source-website

Pagefind search is eagerly loading all results

Open
#212 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
55
Forks
24
Avg merge
1d 21h
Merged PRs (30d)
17

Description

Heya — just floating that the Pagefind search implementation here feels a bit slower than it otherwise could, mainly as the data for all results is loaded up front. If you peep the network tab during a search, the fragments for all results have to load first which slows things down.

The best strategy is to lazy load the data for each result on scroll using an IntersectionObserver, if at all possible, so that only the visible results load their data at any given time :) (nb: 1.5 is also just blanket faster but that's tangential).

If this is the sorta thing you'd toss an agent at, the new pagefind-results.ts component has all the patterns one would want to replicate for a snappier feel.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Pagefind search implementation and compare it with the linked pagefind-results.ts component, focusing on the network requests visible during a search. Use the network tab to confirm that result fragments load only for visible results, including as the user scrolls.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.