explorer icon indicating copy to clipboard operation
explorer copied to clipboard

Explorer: Move static RPC calls behind the Vercel caching layer

Open steveluscher opened this issue 1 year ago • 0 comments

Problem

Blocks are by definition immutable. Client should not hit, for instance, getBlock() over and over and over. Here's the change that needs to be made.

Proposed Solution

  1. Change the frontend to query explorer.solana.com/api/block/{BLOCKNUM}
  2. Move the getBlock call into /pages/api/block/[blocknum].ts
  3. Cache the result of the local API call at the edge, using Vercel caching. Docs here.

Note: you can do lambdas on Vercel without Next.js: https://vercel.com/docs/concepts/functions/serverless-functions Cache control docs: https://vercel.com/docs/concepts/functions/serverless-functions/edge-caching

steveluscher avatar Dec 14 '22 20:12 steveluscher