Skip to content
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.

fix: add miner stats pagination by block range #232

Merged
merged 1 commit into from
Jan 17, 2020

Conversation

shanejonas
Copy link
Contributor

@shanejonas shanejonas commented Jan 16, 2020

image

fixes #223

@shanejonas shanejonas added the enhancement New feature or request label Jan 16, 2020
@@ -88,6 +88,10 @@ function App(props: any) {
useEffect(() => {
if (selectedNetwork && selectedNetwork.name !== query.network) {
setQuery({ network: selectedNetwork.name });
history.push({
pathname: history.location.pathname,
search: `?network=${selectedNetwork.name}`,
Copy link
Member

Choose a reason for hiding this comment

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

Will this work if there are other parameters in the search pattern of the URI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha, thanks. Maybe the supported params should be parts of a config object and standardized/globalized then too, toward fewer magic strings.

Would suggest new ticket for it.

Copy link
Member

@meowsbits meowsbits Jan 16, 2020

Choose a reason for hiding this comment

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

... Or modify the handrolled History logic to use either a library (there must be one...?) and/or/thereby support arbitrary URI path/parameter/hash updates. So that this feature itself becomes some background "just works" magic.

)}>
{authorHashShort}
</Link>
&nbsp;<sup>{hexToString(b.extraData).substring(0, 20)}</sup>
Copy link
Member

Choose a reason for hiding this comment

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

Eventually we might want to refactor this address/+extradata format out to a configurable/standard, eg. substring length, abbreviations, sanitization, ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed. lets make a ticket for that

Copy link
Member

Choose a reason for hiding this comment

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

const blockMapHashRate = (block: any) => {
return {
x: hexToNumber(block.number),
y: hashesToGH(new BigNumber(block.difficulty, 16).dividedBy(config.blockTime)),
Copy link
Member

Choose a reason for hiding this comment

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

Mmmm.. Using a hardcoded block time is a liiiitleee stretchy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea would be nice to calculate the block time for the list of blocks you are looking at. maybe a helper getBlockTimeFromBlocks(blocks)

Copy link
Member

@meowsbits meowsbits left a comment

Choose a reason for hiding this comment

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

Some nits, can be handled or not in later change sets.

@shanejonas shanejonas merged commit b9c9f2e into master Jan 17, 2020
@shanejonas shanejonas deleted the fix/miner-stats-pagination branch January 17, 2020 06:17
@shanejonas
Copy link
Contributor Author

🎉 This PR is included in version 1.8.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paginated Charts via block ranges
2 participants