Skip to content

fix(mobile): offer the question list from the tail, spin only on a pull - #840

Merged
huichen merged 2 commits into
mainfrom
fix/mobile-nav-sync
Sep 25, 2026
Merged

huichen merged 2 commits into
mainfrom
fix/mobile-nav-sync

Conversation

@huichen

@huichen huichen commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

两处“同一个等待/同一件事说了两遍”,都改成跟着读者走

1. 提问导航:一进来就能按 ↑(截图里那对上下按钮)

原来 useQuestionNav 只有在“离开最新”(!atLatest || offset > 32)时才算得出方向,于是刚打开会话时两个按钮都不出现,必须先滑一下才能翻回上一条 —— 而“回到本轮提问”恰好是打开一段长回答后第一个想按的东西。

  • ↑ 现在只看视口行:顶边之上最近的那条提问起点,从最新位置也能算(真机落点仍是“目标提问对齐到列表顶部下方 12px”)。最新位置时它指向当前正在读的这一轮的提问,再按一次才继续往上走。
  • ↓ 仍然要等离开最新:在最新位置上,更新的提问都已经在屏幕里,下面没有可去的。
  • 跳转现在算“读者接管视口”(onTakeOver → useChatScroll.onScrollBeginDrag)。这一步是必需的:只要列表还在 follow 最新,下一次流式提交就会把它钉回底部,跳转会被悄悄撤销 —— 原来跳转只发生在已经离开最新的状态,所以没暴露;「加载更早」按钮早就在做同样的接管。

2. 下拉刷新的转圈:只属于“拉”这个动作

RefreshControl.refreshing 原来绑 timelineSyncStatus,而自动同步也走同一个 lane 状态 ⇒ 截图里那个大白圈会在任何自动同步/重试时转起来,转的位置还是倒置列表的视觉底部(原注释写成“视觉顶部”,一并改正)。现在:

  • 自动同步由列表上方的「正在同步…」胶囊负责(含重试/等待网络三态),原生指示器不再重复报告同一个等待;
  • 只有真下拉才点亮,并且一直转到它重启的那条 lane 落定(laneAtWork 由同一个 lane 信号给出),所以离线下拉不会留下一个空的转圈。

验证

  • 新增/改写的断言都证伪过:把 previous 改回旧逻辑后 offers ↑ from the tail…、↓ retracts…、a jump hands the viewport over… 失败;把 refreshing 改回绑 lane 后 the pull spinner belongs to the pull 失败。
  • mobile:npx tsc --noEmit、npx eslint src、npx jest 全绿(128 suites / 2038 tests)。
  • 截图 harness(?multiTurn=1,自己起 8098 + headless Chrome 9223)在不滚动的初始状态下断言到 {"up":"enabled","down":"disabled","scrollTop":0},按 ↑ 后 {"scrollTop":211,"landed":1,"earlier":0}:视口离开最新、正在读的那一轮提问进入视野且没有跳过头。把改动退回旧逻辑重跑,同一步报 up is not offered before any scroll(按钮根本不存在)。注:harness 里跳转落点(RNW 的 inverted + scrollToIndex 语义)与真机不同,已提交的 qn-align-check 在这台机器上本来也量到 50px 而不是 12px,所以只断言“目标对不对”,不断言像素落点。

A conversation opens at its tail, and ↑ was withheld until the reader had
dragged away from it — so the jump a reader wants first, back to the question
that started the turn on screen, cost a scroll to unlock. ↑ now reads the
viewport rows alone; ↓ still waits for the tail to leave the screen, because
at the tail every newer question is already visible and there is nothing below
to go to. A jump also hands the viewport over to the reader now, which is what
stops the next streaming commit from pinning it back to the bottom.

The pull-to-refresh spinner is bound to the pull instead of to the sync lane:
an automatic sync already says so in the notice above the transcript, and the
native indicator sits at the visual bottom of the inverted list, so the same
wait was reported twice. The spinner still clears when the lane the pull
restarted settles, so a pull offline cannot leave it up.
@huichen
huichen enabled auto-merge (squash) September 25, 2026 14:26
@huichen
huichen merged commit fc52743 into main Sep 25, 2026
12 checks passed
@huichen
huichen deleted the fix/mobile-nav-sync branch September 25, 2026 14:34
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.

1 participant