nebulasio / explorer

Block Explorer of Nebulas
https://explorer-flame.vercel.app
GNU Lesser General Public License v3.0
107 stars 86 forks source link

Smart Contract Address Loading Issue: the new feature view smart contract on contract address page fixed. #59

Closed feliciss closed 5 years ago

feliciss commented 6 years ago

Hi,

In development circle, I found that the example page https://explorer.nebulas.io/#/address/n1gDfiiQLEBu95xDWHGxNi4qToyXjD2vE4D's View Smart Contract router-link is low speed than other and it need to load more than 2 seconds until the whole page loaded.

To demonstrate the problem, let's see the code:

135  <span v-if="contractHash">
136       <router-link class="btn btn-link" v-bind:to='fragApi + "/tx/"+contractHash'>View Smart Contract</router-link>
137  |</span>

305 urlChange() {
306               this.contractHash = ""

311 api.getTransactionByContract({ address: o.address.hash }, this.$route.params.api, (transaction) => {
312      var transaction = JSON.parse(transaction)
313      this.contractHash = transaction.result.hash
314  })

322  data() {
323      return {
324          contractHash: "",

I addressed this problem by adding contract data: contract: null, And pack tx result to contract data: this.contract = transaction.result The if condition:

<span v-if="obj.address.type">
      <router-link class="btn btn-link" v-bind:to='fragApi + "/tx/"+ contract.hash'>View Smart Contract</router-link>
|</span>

Lastly, removing the unnecessary contractHash, I've passed successfully on the above page. This is the mainnet issue, please be aware.

yupnano commented 6 years ago

Thanks for the feedback. I have tried this page, and ddin't see this issue, the page is loaded very fast.

And what's more, this has nothing to do with mainnet. The explorer doesn't get data directly from mainnet when you browsing accounts and transactions, the data is stored in MySQL.

feliciss commented 6 years ago

Sorry for my short and easily misunderstanding voice. The mainnet issue in above means that issue exposes on mainnet explorer. For this issue progress: I cleaned up my browser data and cookies and reload the page: https://explorer.nebulas.io/#/address/n1gDfiiQLEBu95xDWHGxNi4qToyXjD2vE4D. And the problem remaining. I want to point out that this is only a display issue, and the tag 'View Smart Contract' cloud not be synchronously loading with others in the first few seconds.

yuzhouwww commented 5 years ago

I understand what you say, and thanks for your advice! I will consider your suggestion.

yuzhouwww commented 5 years ago

This issue has been fixed, please check n1gDfiiQLEBu95xDWHGxNi4qToyXjD2vE4D, thanks again!