Repository navigation
fix(client): 侧栏记忆入口锚定新会话行,防生态插件挤位 (#130) - #134
Conversation
任务看板/技能中心等生态插件(linxin666 sidebar-entry-core 系)把入口 插在新会话行后且后插入者在上;我们固定在 regionArea 之前,被打成入口 组末尾的孤立位(issue #130 截图:记忆按钮被顶到任务看板/技能中心下)。 - 占位锚点改为紧跟新会话行(logoRow/直接子按钮判定与生态 core 一致, 锚点不可靠时回退 regionArea 之前的旧位置) - MutationObserver 里幂等重排:已在锚点位不写 DOM;生态插件后插入时 搬回,对方只在自身节点被移除时才重插,不会来回争抢 - 关键边界:created 已紧跟锚点时 target 即 created 自身,必须短路返回 ——insertBefore(x, x) 在 Chromium 里不是 no-op,会触发 childList mutation 造成观察器自激风暴冻死 SPA(本地实测踩中并已验证修复) web 8788 junction 直载实测:新建会话 → 记忆 → 任务看板 → SSH → 技能中心 → 工作区,顺序稳定无漂移,入口点击正常打开记忆面板。
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe sidebar entry now anchors after the host New-Session row, supports old and current shell structures, avoids redundant DOM mutations, and repositions itself after ecosystem-injected DOM changes. Tests cover anchor resolution, fallback placement, idempotency, and observer-driven repositioning. ChangesSidebar entry placement
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Low Sequence Diagram(s)sequenceDiagram
participant SidebarTopEntry
participant HostDOM
participant MutationObserver
SidebarTopEntry->>HostDOM: Resolve the newSession anchor
SidebarTopEntry->>HostDOM: Place the entry after the anchor
HostDOM-->>MutationObserver: Report childList changes
MutationObserver->>SidebarTopEntry: Re-run place
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The sidebar placement change has no remaining actionable risk identified for merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ast-grep (0.45.3)dsh-mneme/lib/client.jsast-grep timed out on this file Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
问题
任务看板 / 技能中心等生态插件会把各自的侧栏入口插在「新会话」行之后(后插入者在上);而我们的记忆入口固定插在 regionArea 之前,于是被打成插件入口组的末尾——记忆按钮被顶到任务看板/技能中心下面,视觉上成了孤立位(issue #130 截图)。
根因
sidebar-entry-core:占位规则 =「紧跟新会话行(logoRow)之后」,且只在自身节点被移除时才重插。insertBefore(created, regionArea)一次性放置,位置完全取决于插件安装/挂载时序。修复
logoRow行(现役外壳)或直接子按钮(旧外壳)判定与生态 core 一致;锚点不可靠时回退到 regionArea 之前的旧位置。target === created,必须短路返回——insertBefore(x, x)在 Chromium 里不是 no-op,会触发 childList mutation 造成观察器自激风暴,冻死整个 SPA。已用最小 DOM 实验证实该行为并修复。验证
新建会话 → 记忆 → 任务看板 → SSH → 技能中心 → 工作区,多次交互/等待无漂移;Closes #130
Summary by CodeRabbit