Skip to content

Leaderboard first-load cache, stale-zero plot fix, density off by default, pixel share/copy links#24

Merged
omiaydin1 merged 1 commit into
mainfrom
devin/1782763905-pixel-share-and-fixes
Jun 29, 2026
Merged

Leaderboard first-load cache, stale-zero plot fix, density off by default, pixel share/copy links#24
omiaydin1 merged 1 commit into
mainfrom
devin/1782763905-pixel-share-and-fixes

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Four targeted fixes/additions, file-by-file.

1. Leaderboard first-load speed (useAllMintedPlots, src/hooks/useBaseBoard.ts)

The prior incremental-scan only sped up re-opens; the very first scan of a session still walked the full history from cfg.deployBlock (slow, esp. mobile). Now the completed scan is persisted to sessionStorage keyed by contract and hydrated on mount, so a mid-session reload paints the last-known ranking/ticker instantly and resumes the scan from the persisted lastScannedBlock instead of deployBlock. Only a true first-ever visit (empty cache) pays the full historical scan. No new state-management dependency — plain sessionStorage + JSON.

key = `baseboard:scan:${contract}`
snapshot = { lastScannedBlock, purchases, mintedIds, counts }
// render-time: scanStateRef hydrated from snapshot (ref → no SSR/CSR mismatch)
// mount effect: setRaw(snapshot.purchases, snapshot.counts)  // instant paint
// after each successful pass: savePersistedScan(...)          // refresh cache

The ownership read (getPlotsBatch) still runs over the full accumulated mintedIds every pass; only discovery is incremental. Tie-break logic untouched.

2. Stale/incorrect Pixel Details (usePlot, same file)

A lagging/load-balanced public RPC node sometimes returns a stale owner === ZERO_ADDRESS read for a plot that's actually owned, which rendered an owned, image-set pixel as unowned/for-sale. Fix: when the fresh read is zero but an optimisticPlots override shows a real owner, the override wins (even after onchain resolves), and a single extra refetch() is scheduled ~800ms later instead of accepting the contradicting read.

overrideOwned && onchainZero  ⇒  keep override + setTimeout(refetch, 800)
plot = override ?? onchain      // override still wins

3. Density overlay defaults OFF (src/store/useBoardStore.ts)

densityEnabled: true → false. Users opt in via the toggle; the heatmap is no longer active on load (and when off, the canvas already skips baking/drawing the field entirely).

4. Share-to-X + Copy-link in Pixel Details (src/components/PlotModal.tsx, deep-link in src/app/page.tsx)

Two secondary blue/white buttons added directly below the Link row, shown for every owned pixel (independent of whether it has a custom image/link):

  • Share on X → opens https://x.com/intent/tweet with the exact caption I just claimed my spot on BaseBoard 🟦 #Base @base and a url param = this pixel's shareable link, all URL-encoded.
  • Copy Link → copies ${origin}/?pixel=<id> (async clipboard with a execCommand fallback) and swaps the label to Copied! for ~2s.

The shareable URL reuses a new minimal ?pixel=<id> convention wired into the app's initial load (page.tsx): on mount it parses/validates the id and calls the same openPlot(id) (+ setFocusPlotId) the board's own click handler uses — auto-opening the existing Pixel Details modal, no new page/route/layout.

Verification

Link to Devin session: https://app.devin.ai/sessions/fc70b93ff3f5431d9a3fbb9cd0935438
Requested by: @omiaydin1

…ault, pixel share/copy links

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@omiaydin1 omiaydin1 self-assigned this Jun 29, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
baseboard Ready Ready Preview, Comment Jun 29, 2026 8:16pm

@devin-ai-integration devin-ai-integration Bot changed the base branch from devin/1780953440-baseboard-mini-app to main June 29, 2026 20:15
@omiaydin1 omiaydin1 merged commit 753ff56 into main Jun 29, 2026
2 checks passed
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.

1 participant