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

set timeout for loading message on the main page #2324

Merged
merged 7 commits into from
Jul 23, 2019

Conversation

ayrat555
Copy link
Contributor

@ayrat555 ayrat555 commented Jul 9, 2019

resolves #2252

Changelog

  • set timeout for loading message on the main page

@coveralls
Copy link

coveralls commented Jul 9, 2019

Pull Request Test Coverage Report for Build 6dde37f0-0ddf-4ffa-9c27-fd7aeaa7ee2a

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.08%) to 80.93%

Files with Coverage Reduction New Missed Lines %
apps/indexer/lib/indexer/fetcher/token.ex 1 80.0%
apps/indexer/lib/indexer/fetcher/token_balance.ex 2 87.88%
apps/indexer/lib/indexer/block/fetcher.ex 3 88.31%
Totals Coverage Status
Change from base Build d2833198-1e76-44a9-a77e-3570f9b477b4: -0.08%
Covered Lines: 5203
Relevant Lines: 6429

💛 - Coveralls

setTimeout(function () {
$el.removeAttr('hidden')
$el.show()
}, 1000)
Copy link
Contributor

@saneery saneery Jul 15, 2019

Choose a reason for hiding this comment

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

what if transactionLoading value changes before the timeout function run?
I mean that first $el.hide() runs, and after $el.show() runs with a delay.
Maybe we should check that transactions weren't loaded before show message in the timeout function.

Copy link
Member

Choose a reason for hiding this comment

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

@saneery Could you elaborate, how this case is possible?

Copy link
Contributor

Choose a reason for hiding this comment

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

@vbaranov in a case with blocksLoading

  1. blocksLoading is true
  2. showLoading(blocksLoading, $el) is called
  3. the timer is created with a delay in 1sec
  4. after 0.5 sec blocks are loaded and blocksLoading is changed to false
  5. showLoading(blocksLoading, $el) is called and $el is hided
  6. after 0.5 sec timer's function is called and $el is showed

But I've tried to debug how blocksLoading is changed. It looks like it doesn't turn into false.
I've set console.log into the code:

'[data-selector="chain-block-list"] [data-selector="loading-message"]': {
    render ($el, state, oldState) {
      console.log(state.blocksLoading)
      showLoader(state.blocksLoading, $el)
    }
  }

and set into showLoading

export function showLoader (isTimeout, loader) {
  if (isTimeout) {
    const timeout = setTimeout(function () {
      console.log('timeout function')
      loader.removeAttr('hidden')
      loader.show()
    }, 1000)
    return timeout
  } else {
    console.log('hide function')
    loader.hide()
    return null
  }
}

And I had this:
image

Copy link
Member

Choose a reason for hiding this comment

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

@saneery However, I would leave else as a general fallback, if you don't have objections

@vbaranov vbaranov requested review from pasqu4le, saneery and vbaranov and removed request for vbaranov July 18, 2019 16:20
@vbaranov vbaranov merged commit 0fd775f into master Jul 23, 2019
@vbaranov vbaranov deleted the ab-set-timeout-on-loading-messages branch July 23, 2019 10:06
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.

Show loaders on the main page only if wait is > 1sec
5 participants