feat(frontend): 热榜翻页跟随服务端快照信号
服务端有三条重置信号。as_of 与请求不同、snapshot_rebuilt 为 true、ranking_source 与上一页不同。 任一条成立时,loadHot 以响应的 as_of 从 offset 0 重取一次。offset 在新榜上已失去意义。 否则按 next_offset 追加。用户因此不会看到重复的名次。 类型定义补上 ranking_source 与 snapshot_rebuilt。next_latest_* 标注废弃但保留。 验证:npm run build 通过。
This commit is contained in:
@@ -75,11 +75,22 @@ export type ListLikesCountResponse = {
|
||||
|
||||
export type ListByPopularityResponse = {
|
||||
video_list: FeedVideoItem[]
|
||||
/** 本次快照的标识(分钟右端,必为已闭合分钟)。翻页时原样带回。 */
|
||||
as_of: number
|
||||
next_offset: number
|
||||
has_more: boolean
|
||||
/**
|
||||
* 这一页来自哪里:`hot` = Redis 点时快照,`hot_db` = MySQL 重算同一窗口,
|
||||
* `latest` = 窗口内无互动、返回最新视频(终结页)。
|
||||
*/
|
||||
ranking_source: 'hot' | 'hot_db' | 'latest'
|
||||
/** 服务端刚重建过快照:这一页可能与上一页重叠,应当从 offset 0 重来。 */
|
||||
snapshot_rebuilt: boolean
|
||||
/** @deprecated 旧游标字段,服务端不再返回,仅为兼容旧客户端保留声明。 */
|
||||
next_latest_popularity?: number
|
||||
/** @deprecated 见 next_latest_popularity。 */
|
||||
next_latest_before?: string
|
||||
/** @deprecated 见 next_latest_popularity。 */
|
||||
next_latest_id_before?: number
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user