Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Load block transactions progressively #718

Merged
merged 5 commits into from
Oct 13, 2021
Merged

Load block transactions progressively #718

merged 5 commits into from
Oct 13, 2021

Conversation

danielcolinjames
Copy link
Contributor

@danielcolinjames danielcolinjames commented Oct 5, 2021

Fixes #715

Right now, /blocks/:blocknumber has to pull all of the block transactions before displaying them. The UI breaks it into all the different transaction types in the block, which it can't do without loading them all:
Screen Shot 2021-10-04 at 5 41 46 PM

This worked okay when there were <200 transactions per block, but doesn't work great now that there are 1000+. It takes a long time to load, because it probably requests way more than it should have to from the API.

This PR refactors this view to fetch the transactions progressively as you scroll, like so:
2021-10-04 17 52 31

Obviously this is not ideal in terms of UX, since it doesn't allow for easily finding transactions within a given block. Below I've outlined how we can get the best of both worlds, potentially in a future PR:

Future considerations

If we want to keep the UI this way (which I think I would lean toward, since it is a very useful way to look at what is in a block), we would probably need 2 API changes:

  1. inside the block 'metadata' (/blocks/:height), if we could get a breakdown of the transaction types, in addition to the transaction_count field, we could populate the transaction types widget at the top with that info. For example:
{
    "data": {
        "transaction_count": 9,
        "transaction_types": {
            "poc_request_v1": 5,
            "poc_receipts_v1": 3,
            "add_gateway_v1": 1
        },
        "time": 1572472462,
        "snapshot_hash": "",
        "prev_hash": "I8LYrdL-Imq34IDwUCuMUYI2opUN9wcfJvt1hKJffzo",
        "height": 100000,
        "hash": "pqHszXWVprhh0yuIbH8usdIixQ9NiSoc1RSjP1-hu4Q"
    }
}
  1. We would need the ability to filter by transaction types when fetching the transactions from a block. Right now there is just /blocks/:height/transactions, and a cursor query param. We would need a filter_types param like the /activity endpoint has.

I've put the above 2 requests in helium/blockchain-http#339

@cokes518
Copy link
Member

cokes518 commented Oct 6, 2021

check arrow padding and vertical scroll bar.
also check to see if we can keep position after clicking on a transaction.

@allenan allenan temporarily deployed to helium-explorer-pr-718 October 13, 2021 19:42 Inactive
@allenan allenan merged commit ad97bb2 into v2 Oct 13, 2021
@allenan allenan deleted the block-types branch October 13, 2021 19:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove tab UI from block details
3 participants