Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/stores/useBaseStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ export const useBaseStore = defineStore('baseStore', {
async fetchLatest() {
if (!this.hasRpc) return this.latest;
try {
this.latest = await this.blockchain.rpc?.getBaseBlockLatest();
const latest = await this.blockchain.rpc?.getBaseBlockLatest();
// A malformed 200 (an error body, a rate-limit page) would otherwise be
// stored as `latest`; its missing chain_id then trips the reset below and
// wipes earliest/recents, resetting the average block time to the 1000ms
// placeholder. Treat it as a failed poll instead.
if (!latest?.block?.header?.height) throw new Error('malformed blocks/latest payload');
Comment thread
2xburnt marked this conversation as resolved.
Outdated
this.latest = latest;
this.connected = true;
} catch (error) {
console.error('Error fetching latest block:', error);
Expand Down
Loading