Skip to content
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

[explorer] task: hide hash lock section #1137

Merged
merged 4 commits into from
Oct 21, 2022
Merged

Conversation

AnthonyLaw
Copy link
Member

What was the issue?

  • hash lock section is displayed on all transaction-type detail pages, technically it should only display in Aggregate Bonded transaction
  • hideEmptyData is not working correctly.

What's the fix?

  • Refactoring on transaction store, hash lock info will only request when the transaction type is AGGREGATE_BONDED, It will reduce API call and performance increment for other transaction types.
  • fix hideEmptyData issue.
  • added unit test

@netlify
Copy link

netlify bot commented Oct 17, 2022

Deploy Preview for explorer-dev ready!

Name Link
🔨 Latest commit c61a7e7
🔍 Latest deploy log https://app.netlify.com/sites/explorer-dev/deploys/6352ba907ba5380008edc221
😎 Deploy Preview https://deploy-preview-1137--explorer-dev.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@cryptoBeliever
Copy link

cryptoBeliever commented Oct 18, 2022

@AnthonyLaw looks good 👍

Hash lock information is visible for aggregate bonded (in the partial and confirmed state):
image

The hash lock section is not visible for other transaction types:
image

cryptoBeliever
cryptoBeliever previously approved these changes Oct 18, 2022
__tests__/views/PageAssembler.spec.js Outdated Show resolved Hide resolved
__tests__/store/transaction.spec.js Outdated Show resolved Hide resolved
if (Array.isArray(data)) {
return !!data.length;
} else {
return !!Object.keys(data).length
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should work also for arrays, so nested if statement is not necessary here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I would suggest to change this part only to return false when hideEmptyData is true and Object.keys(data).length is 0.
Otherwise when hideEmptyData is positive, we will never reach the part below (and all errored views will be rendered):
[L138] if (item.hideOnError && this.getter(item.managerGetter)?.error)

Copy link
Member Author

Choose a reason for hiding this comment

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

Also I would suggest to change this part only to return false when hideEmptyData is true and Object.keys(data).length is 0.
Otherwise when hideEmptyData is positive, we will never reach the part below (and all errored views will be rendered):
[L138] if (item.hideOnError && this.getter(item.managerGetter)?.error)

that makes sense 👍🏼

Copy link
Contributor

@OlegMakarenko OlegMakarenko left a comment

Choose a reason for hiding this comment

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

👍

Copy link

@Jaguar0625 Jaguar0625 left a comment

Choose a reason for hiding this comment

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

looks good 👍

@AnthonyLaw AnthonyLaw merged commit a54dc05 into dev Oct 21, 2022
@AnthonyLaw AnthonyLaw deleted the task/hide-hash-lock-section branch October 21, 2022 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction Details. The hash lock section issue
4 participants