Skip to content

Conversation

@o-az
Copy link
Member

@o-az o-az commented Dec 9, 2025

#219

Before:

new blocks were prepended to stale data, creating gaps: [150, 100, 99, ...]

After:

gap detection clears stale data and triggers a refetch: [150, 149, 148, ...]

@o-az o-az self-assigned this Dec 9, 2025
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

🚀 Deploying o-az/fix-blocks-gap with ⚡ Cloudflare Pages

Latest commit: 158e879f813691b1c424c0e2b6bcaade421804b5
Status: ✅ Deploy successful
Preview URL: https://2ea90427-explorer.porto.workers.dev
Branch Preview URL:


// If we have existing blocks, check for continuity
const prevLatest = prev[0]?.number
if (prevLatest != null && latestBlock.number != null) {
Copy link
Member

Choose a reason for hiding this comment

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

should we stick to strict equals? or just prevLatest && latestBlock.number

// Re-initialize liveBlocks when empty and fetchedBlocks is ready
// Don't fall back to queryData.blocks here - it may be stale after a gap reset.
// The blocks memo handles the temporary display while fetchedBlocks loads.
React.useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

I think we could skip the useEffect here since we check for liveBlocks.length === 0 and fetchedBlocks.length > 0, guaranteeing that the next render will fill liveBlocks

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.

3 participants