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

Align contract event log l&f with transactions #2812

Merged
merged 3 commits into from
Oct 25, 2016
Merged

Conversation

jacogr
Copy link
Contributor

@jacogr jacogr commented Oct 22, 2016

Closes #2807

@jacogr jacogr added A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. M5-ui labels Oct 22, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 86.251% when pulling 85f3c38 on jg-contract-events into 9150fce on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 86.241% when pulling 6532f69 on jg-contract-events into 9150fce on master.

@jacogr jacogr added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Oct 22, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 86.13% when pulling f644348 on jg-contract-events into 9150fce on master.

@jacogr jacogr changed the title Align contract event log l&f with transactions (Closes #2807) Align contract event log l&f with transactions Oct 22, 2016
const block = blocks[event.blockNumber.toString()];
const transaction = transactions[event.transactionHash] || {};
const classes = `${styles.event} ${styles[event.state]}`;
const url = `https://${isTest ? 'testnet.' : ''}etherscan.io/tx/${event.transactionHash}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't we have this URL constructor more DRY ? If etherscan ever goes down, or change its URL structure, it would be good to only modify it in one place whether than in every component

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to log these seperately - think they are valid points, just not quite up to the task at exactly this point in time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return (
<Container>
<ContainerTitle title='events' />
<table className={ styles.events }>
<tbody>{ rows }</tbody>
<tbody>{ events.map((event) => <Event event={ event } key={ event.key } />) }</tbody>
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't we pass the block and transaction info directly here, like that every Event Component won't have the whole blocks and transactions state Objects in their props? They can still be the ones triggering the fetching, but only receiving the right block and transaction Object. Not sure if it's a real perf. gain though...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As these will be references, there won't be additional copies made. So at least from an overhead point of view things should be fine.

As a general point, you are probably right - no need to do connect on Events & Event if it can be helped.

@ngotchac
Copy link
Contributor

Looks really nice in the UI! Quick remark: couldn't a progress loading bar be displayed while fetching the events?

@ngotchac ngotchac added A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging. and removed A0-pleasereview 🤓 Pull request needs code review. labels Oct 24, 2016
@jacogr
Copy link
Contributor Author

jacogr commented Oct 25, 2016

I'm actually worried about the event/transactions/blocks - at least to main untrained eye it seems much slower now with Redux. In addition we are now keeping state we never get rid of, may not be too much of a concern in "normal use".

@ngotchac
Copy link
Contributor

That's true, but it seems safer and removes a lot of errors we had before when switching views while fetching content, then setting state on unmounted components.
If the increasing number of saved blocks/txs/... is an issue, we could have some sort of a cache invalidator.

@jacogr jacogr merged commit 7eacf07 into master Oct 25, 2016
@jacogr jacogr deleted the jg-contract-events branch October 25, 2016 20:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants