-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Conversation
Pull Request Test Coverage Report for Build 6dde37f0-0ddf-4ffa-9c27-fd7aeaa7ee2a
💛 - Coveralls |
setTimeout(function () { | ||
$el.removeAttr('hidden') | ||
$el.show() | ||
}, 1000) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
blocksLoading
istrue
showLoading(blocksLoading, $el)
is called- the timer is created with a delay in 1sec
- after 0.5 sec blocks are loaded and
blocksLoading
is changed tofalse
showLoading(blocksLoading, $el)
is called and$el
is hided- 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
}
}
There was a problem hiding this comment.
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
…ery time before the chart rendered even if wait less than 1 sec
resolves #2252
Changelog