bugfix
This commit is contained in:
@@ -31,6 +31,13 @@ Page({
|
|||||||
redirectToLogin()
|
redirectToLogin()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 首帧渲染未结束就 setData 会触发「Expected updated data but get first rendering data」,
|
||||||
|
// 整个 webview 渲染失败。首次 onShow 的刷新延迟到下一帧
|
||||||
|
if (!(this as any).firstShown) {
|
||||||
|
;(this as any).firstShown = true
|
||||||
|
wx.nextTick(() => this.refresh())
|
||||||
|
return
|
||||||
|
}
|
||||||
this.refresh()
|
this.refresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -45,10 +45,17 @@ Page({
|
|||||||
redirectToLogin()
|
redirectToLogin()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 跨天回到本页时旧数据仍是昨天的,需重新拉取
|
// 首帧渲染未结束就 setData 会触发「Expected updated data but get first rendering data」,
|
||||||
|
// 整个 webview 渲染失败,用户视觉上仍看到上一个页面。首次 onShow 的数据拉取延迟到下一帧
|
||||||
const stale =
|
const stale =
|
||||||
!this.data.horoscope || Number(this.data.horoscope.stat_date) !== todayStatDate()
|
!this.data.horoscope || Number(this.data.horoscope.stat_date) !== todayStatDate()
|
||||||
if (stale) this.fetchHoroscope(0)
|
if (!stale) return
|
||||||
|
if (!(this as any).firstShown) {
|
||||||
|
;(this as any).firstShown = true
|
||||||
|
wx.nextTick(() => this.fetchHoroscope(0))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.fetchHoroscope(0)
|
||||||
},
|
},
|
||||||
|
|
||||||
syncTabBar() {
|
syncTabBar() {
|
||||||
|
|||||||
@@ -36,6 +36,13 @@ Page({
|
|||||||
this.setData({ activeTab: 1, list: [], loading: true })
|
this.setData({ activeTab: 1, list: [], loading: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 首帧渲染未结束就 setData 会触发「Expected updated data but get first rendering data」,
|
||||||
|
// 整个 webview 渲染失败,用户视觉上仍看到上一个页面。首次 onShow 的刷新延迟到下一帧
|
||||||
|
if (!(this as any).firstShown) {
|
||||||
|
;(this as any).firstShown = true
|
||||||
|
wx.nextTick(() => this.refresh())
|
||||||
|
return
|
||||||
|
}
|
||||||
this.refresh()
|
this.refresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,15 @@ Page({
|
|||||||
redirectToLogin()
|
redirectToLogin()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 首帧渲染未结束就 setData 会触发「Expected updated data but get first rendering data」,
|
||||||
|
// 整个 webview 渲染失败,用户视觉上仍看到上一个页面(从 login switchTab 过来时表现为
|
||||||
|
// "卡在登录页")。把首次 onShow 的刷新延迟到下一帧,规避首帧冲突。
|
||||||
|
if (!(this as any).firstShown) {
|
||||||
|
;(this as any).firstShown = true
|
||||||
|
wx.nextTick(() => this.refresh())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.debug(LOG, 'onShow 触发刷新')
|
||||||
this.refresh()
|
this.refresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user