Conversation
chore: remove sc 24h txs
fix: nft precision tx list
…tern (#601) * fix: blocks page stale auto-update, timer drift, and Promise anti-pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address review findings - consistent error handling, proper type separation - Fix yesterdayStatisticsCall and totalStatisticsCall to throw on error instead of silently returning error string as IBlockStats (was causing silent display of zeros on API failures) - Normalize error messages with typeof guard for non-string errors - Revert dataUpdatedAt from shared ICard type to local CardContentProps - Track both queries' dataUpdatedAt using Math.min for accurate staleness - Remove silent Date.now() fallback, show empty string before first fetch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: prevent rendering bare " ago" before data loads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Merge pull request #593 from klever-io/chore/remove-sc-24h-txs chore: remove sc 24h txs * Merge pull request #602 from klever-io/fix/nft-precision-tx-list fix: nft precision tx list * fix: blocks page stale auto-update, timer drift, and Promise anti-pattern (#601) * fix: blocks page stale auto-update, timer drift, and Promise anti-pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address review findings - consistent error handling, proper type separation - Fix yesterdayStatisticsCall and totalStatisticsCall to throw on error instead of silently returning error string as IBlockStats (was causing silent display of zeros on API failures) - Normalize error messages with typeof guard for non-string errors - Revert dataUpdatedAt from shared ICard type to local CardContentProps - Track both queries' dataUpdatedAt using Math.min for accurate staleness - Remove silent Date.now() fallback, show empty string before first fetch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: prevent rendering bare " ago" before data loads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: David Ianakiara <david@klever.io> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThis PR refactors data synchronization and error handling across three modules. It introduces timestamp tracking for data freshness in the blocks page by capturing update metadata from queries and deriving a combined update time. It corrects asset precision lookups in transactions by parsing asset IDs. Error handling in API calls is unified to use async/await with standardized error throwing instead of manual Promise construction. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #604 +/- ##
=========================================
- Coverage 0.46% 0.46% -0.01%
=========================================
Files 530 530
Lines 20951 20953 +2
Branches 5280 4989 -291
=========================================
Hits 97 97
- Misses 20042 20856 +814
+ Partials 812 0 -812 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/pages/blocks/index.tsx`:
- Around line 148-165: The statistics queries now throw on failure, so update
the useQuery destructuring for both calls (the blocksStatsToday /
isLoadingBlocksStatsToday / refetchTotal / totalUpdatedAt and
blocksStatsYesterday / isLoadingBlocksStatsYesterday / refetchYesterday /
yesterdayUpdatedAt) to also pull isError and error, and change rendering logic
to check isError or data === undefined before falling back — do not use the `||
0` fallback for missing data; instead show an error/placeholder or skip
rendering until data is present so failed fetches don't display fake zeroes.
In `@src/services/apiCalls.ts`:
- Around line 5-18: The function blockCall currently declares its return type as
IBlockResponse but the endpoint returns multiple blocks; change the return type
of the blockCall function signature from IBlockResponse to IBlocksResponse,
update any local references inside blockCall or its callers to expect
data.blocks (IBlock[]) instead of data.block, and ensure the IBlocksResponse
type is imported/available where blockCall is defined so the signature compiles.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f2eb4e94-c9ef-4baa-99da-02a0c880c71e
📒 Files selected for processing (3)
src/pages/blocks/index.tsxsrc/pages/transactions/index.tsxsrc/services/apiCalls.ts
Summary by CodeRabbit
New Features
Bug Fixes