refactor: rename staticTabId → currentTabId, clarify tab id semantics (phase 3)#22
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
整理 tab id 语义,消除
staticTabId这一误导性命名。Phase 3 of workspace-switch refactor.Changes
命名修正
atoms.staticTabIdatoms.currentTabIdgetLayoutModelForStaticTab()getLayoutModelForCurrentTab()getStaticTabBlockCount()getCurrentTabBlockCount()simpleCloseStaticTab()simpleCloseCurrentTab()getFocusedBlockInStaticTab()getFocusedBlockInCurrentTab()staticTabId的原语义是 "这个 renderer 永远代表某个固定 tab",但 Phase 1/2 已明确 renderer 在 workspace switch 时被复用,每次 reinit 都会更新这个值。"static" 前缀会让后续维护者误判它不应该被更新。命名决策过程
初始 PR 使用了
activeTabId,但 Code Review 指出它与tab-model.ts的activeTabIdAtom(workspace canonical active tab)名字过于相似,语义却不同:activeTabIdAtomtab-model.tsctx.activeTabId(workspace 的 canonical active tab)atoms.activeTabId(已废弃)global-atoms.tsctx.ownTabId或ctx.activeTabId最终选定
currentTabId——准确反映"当前 renderer context 正在使用的 tab",不与任何已有名字冲突。Code Review 闭环
rg "StaticTab" frontend/→ 0 结果rg "atoms\.activeTabId" frontend/→ 0 结果测试 Note