Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account activity loading enhancement #334

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

deansallinen
Copy link
Contributor

@deansallinen deansallinen commented Jan 15, 2025

  • Landing on the account/overview page will prefetch the data for the initial account/activity page load
  • Navigating to an account/activity page will prefetch the data for the next page
  • The inital account/activity page (a.k.a. the most recent data) is cached for 5s while older activity beyond the first page is cached for 3600s (1 hour)
    • Note: with this approach, if there is a new activity it'll push the index + 1 and invalidate the benefits of the cache for next page...

Copy link

cloudflare-workers-and-pages bot commented Jan 15, 2025

Deploying 2nicove with  Cloudflare Pages  Cloudflare Pages

Latest commit: e64cca2
Status: ✅  Deploy successful!
Preview URL: https://e5790cf7.unicove2.pages.dev
Branch Preview URL: https://account-activity-loading.unicove2.pages.dev

View logs

stale while revalidate should be longer than max age otherwise it
doesn't get triggered
const headers = getCacheHeaders(5);
const start = params.start === '0' ? 1 : Number(params.start);

// Aggressively cache older activity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't do this, because older activity shifts in time and the results aren't in the same sequence because its in descending order.

If the initial page shows records 99 through 90 (walking back in time), and page 2 shows 89 to 80 - then if a new entry is added to the front, record 90 would end up on page 2. If page 2 is cached, that record won't show.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants