-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Statistics seconds counter #348
Conversation
src/screens/Dashboard.js
Outdated
setSummary({ | ||
bestBlockHeight: heightData.best_block_height, | ||
transactions: heightData.transactions, | ||
hashRate: heightData.hash_rate, | ||
}); | ||
setTimestamp(new Date(heightData.time * 1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to set this if you can use the data from redux directly?
I think if you use heightData
directly you could remove the whole useEffect
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a complement to Pedro's comment, you can track change looking only to the value of best_block_height
, not the whole object of heightData
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, always good to remove local state from components!
The useEffect
was still necessary, as the websocket implementation that provides the height data is not ideal for our needs.
However, the effect now deals exclusively with the time counter data, and not the exhibited values, see 5c6299b.
54e2f49
to
5179cab
Compare
In the new interface, the timer does not update when the number of txs or the blocks height change. An example of the timer is as follows:
A new version of this screen has changed the counter to the title element, instead of inside each of the realtime boxes, as follows:

Acceptance Criteria
Notes
The current implementation is still not precise, because the
time
property of thedashboard:metrics
websocket event received has no relation to the best block or transaction data.This screen should rely on the information received through the websocket as it is now, but the server-side implementation of this event should be changed in the future to provide more precise information here.
Security Checklist