remove page flash due to LazyPage.html

This commit is contained in:
Nolan Lawson 2018-04-14 14:17:19 -07:00
parent d5c9af08e9
commit 9fb33b4a7d
1 changed files with 10 additions and 1 deletions

View File

@ -2,8 +2,17 @@
<:Component {pageComponent} :params />
{{/if}}
<script>
// On the very first page load, avoid doing a "reveal" because
// it leads to a flash between when the SSR is shown, the two frame we hide it,
// and then when we show it again.
//
// We only really need LazyPage behavior when the user is clicking around
// after the page has loaded, to improve input responsiveness.
let firstTime = true
export default {
oncreate() {
firstTime = false
requestAnimationFrame(() => {
requestAnimationFrame(() => {
this.set({revealed: true})
@ -11,7 +20,7 @@
})
},
data: () => ({
revealed: !process.browser
revealed: !process.browser || firstTime
})
}
</script>