Repository navigation
fix(org-workbench): keep stale employee panels on switch (#413) - #417
Conversation
waterbro-8
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES,head 4abc1705。方向对(stale-while-revalidate + 空态不跟 skeleton 叠),但现在不能批。
- CONFLICTING/DIRTY: base 停在 #414(
6e26755a),#410 已经进 main(f5e9af18)。多半是 CHANGELOG 同一处。请 rebase 到最新 main。我推不了你的分支。 - sessionId === null 不再
setTurns([]): 切到还没有 session 的员工 B 时,A 的线程会一直留在 B 的面板上。stale-while-revalidate 只应持续到 B 的 history/空 session 有结果;确认 B 无 session 后要清掉 A 的 turns(按 selectedId 盖戳也行)。 - CI 还没跑。rebase 后等绿再叫我复审。非产品验收。
4abc170 to
c100f94
Compare
|
Rebased onto current
#410 ( |
Stop blanking PositionCard and TurnThread into skeletons when selecting another employee. Keep the previous record/thread until the new payload arrives, hide the empty-state node while loading, and drop the tree selected-fill crossfade so two rows cannot glow at once. Once the target employee is confirmed to have no session, drop the previous thread so it cannot remain on the new panel.
c100f94 to
37b4b33
Compare
waterbro-8
left a comment
There was a problem hiding this comment.
Code review APPROVE (not product 验收), head 37b4b33d.
Rebase onto current main looks clean (CHANGELOG keeps #412 and #413). Confirmed-empty session now setTurns([]) after the sessions read (and on sessions fail / offline), so employee A's thread does not stick on B. Tests cover in-flight stale card/thread and the no-session clear. CI 11/11 green.
Not product 验收. 胡奕舟 can merge.
PeterGuy326
left a comment
There was a problem hiding this comment.
Approved at head 37b4b33d. Read the full diff and traced the state transitions in App.tsx at this head.
Verified in code:
loadPositionkeepsprev.dataonly whileloading; every terminal path still overwrites it (404 /position_missing→notFound: true, non-200 →data: null, catch →data: null), so a failed fetch cannot pin employee A's record on B's panel.- The three removed
setTurns([])calls are covered byloadSessions: the confirmed-empty session branch, the non-200 sessions branch, and the offline catch all clearturnsandhistoryLoading, each guarded byselectionVersion+selectedIdRef. A late read for A therefore cannot wipe B, andloadTurnHistoryreturning early onsessionId === nullwithout clearing is safe. selectPositionbumpsselectionVersionbefore the stale window opens, which is what keeps A's in-flight reads inert..owb-turn-thread--empty[hidden] { display: none }is load-bearing rather than dead CSS: the author rule setsdisplay: flexon--empty, which beats the UA[hidden] { display: none }, and the<ol>still carries both the--emptyclass andhidden. The new selector wins on specificity (0,2,0 vs 0,1,0) and on source order.- Dropping
transition: backgroundfrom.ui-org-tree__rowmakes theprefers-reduced-motionoverride redundant, so removing that block is consistent.
Non-blocking, worth a follow-up: during the stale window selectedPosition is still A's record while selectedId is already B, and the actions slot mixes the two — DismissPositionDialog renders selectedPosition.name (A) alongside selectedNode's descendant count (B) and calls dismissPosition(selectedId) (B). The window is a single local position() round trip, so it is not realistically clickable today, but the label/target split is the kind of thing that bites later. Fine to land as-is.
CI 11/11 green on this head. waterbro-8's approval covers the rebase and the no-session clear; my pass was a diff + source read, I did not re-run the renderer suites locally.
Summary
Fixes #413: switching employees in the org workbench no longer flashes both the center
PositionCardand the rightTurnPanelto skeletons, stacks empty-state on the loading thread, or crossfades two tree-row highlights.What changed
loadPositionkeeps the previouscard.datawhileloadingis true;PositionCardonly skeletons when there is no record yet.setTurns([])before the next history arrives; a null session during attach no longer wipes the current thread.TurnThreaddoes not mount the empty-state node while loading; CSS.owb-turn-thread--empty[hidden] { display: none }covers thedisplay:flexvs[hidden]override.background, so selected fill moves in one frame.Tests
packages/uiPositionCard stale-while-loading + org-tree CSS contractTurnPanelloading does not keep.ui-org-empty-statein the DOMAppA→B with B'sposition()in flight keeps A's card heading and threadrenderer-css-syntaxasserts the[hidden]rulenpm run test:ui(40),App.test.tsx(86),TurnPanel.test.tsx(28),renderer-css-syntax.test.cjs(3).Acceptance (#413)
.owb-panelshell no longer collapses to a 4-row skeleton over stale content