Leaderboard first-load cache, stale-zero plot fix, density off by default, pixel share/copy links#24
Merged
Conversation
…ault, pixel share/copy links Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tosessionStoragekeyed by contract and hydrated on mount, so a mid-session reload paints the last-known ranking/ticker instantly and resumes the scan from the persistedlastScannedBlockinstead ofdeployBlock. Only a true first-ever visit (empty cache) pays the full historical scan. No new state-management dependency — plainsessionStorage+JSON.The ownership read (
getPlotsBatch) still runs over the full accumulatedmintedIdsevery 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_ADDRESSread 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 anoptimisticPlotsoverride shows a real owner, the override wins (even afteronchainresolves), and a single extrarefetch()is scheduled ~800ms later instead of accepting the contradicting read.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 insrc/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):
https://x.com/intent/tweetwith the exact captionI just claimed my spot on BaseBoard 🟦 #Base @baseand aurlparam = this pixel's shareable link, all URL-encoded.${origin}/?pixel=<id>(async clipboard with aexecCommandfallback) and swaps the label toCopied!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 sameopenPlot(id)(+setFocusPlotId) the board's own click handler uses — auto-opening the existing Pixel Details modal, no new page/route/layout.Verification
npm run typecheck✅ ·npm run lint✅ (0 warnings) ·npm run build✅sessionStorage) still does the full scan.#Base+@base+ encoded pixel URL; Copy writes?pixel=<id>and showsCopied!; loading that URL auto-opens the existing modal populated with the pixel's real data and pans the camera to it.Link to Devin session: https://app.devin.ai/sessions/fc70b93ff3f5431d9a3fbb9cd0935438
Requested by: @omiaydin1