chore: 合入 dev 最新提交(#1241 Git Graph 分页去重)
This commit is contained in:
commit
8d59fbe44e
4 files changed
+46
-4
No files matched your search
@@ -4,6 +4,8 @@
|
||||
|
||||
### 未发布
|
||||
|
||||
- **减少 Git 提交图加载更多历史时的去重开销**([#1063](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1063) 第 5 项)。追加一页时按完整提交哈希为已加载历史建立集合,再按原顺序追加新记录。整页重复时也会继续推进分页游标。
|
||||
|
||||
- 🧪 **DSH 0.2.3-alpha.2(alpha 线)适配**:14 条 DSH peer 与 `engines.dsh` 同批抬到 `0.2.3-alpha.2`,Cordis 依赖线同步到 `4.2.0-alpha.1`。宿主删除了 `@deepseek-ai/dsh-llm` 的 `./brand` 子路径,类型改从 `./types` 引入;目录投影的权威事件从 `working-directory/change` 换成 `workspace-root/change`,侧边对话的 cwd 边界戳记与工作树跟随随之调整;同时删除了所有旧宿主兼容分支(准入 `requestRejection` 回退、旧目录事件、旧 `data-slot` 锚点、`getOrigin` 探测)——这一版只服务 0.2.3-alpha.2+,更早宿主固定 v0.33.0。
|
||||
|
||||
- 🎛️ **紧凑划选菜单**:操作菜单与译文面板分开定宽;改写悬停时向有空间的一侧展开二级浮层,也支持点击与键盘进入。窄屏仍保持侧弹,必要时覆盖部分主菜单。翻译结果的「返回 / 复制」改为并排底栏,长译文单独滚动。
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
### Unreleased
|
||||
|
||||
- **Reduce Git Graph deduplication work when loading more history** ([#1063](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1063), item 5). Each append indexes the full hashes of loaded commits before filtering the incoming page. New commits keep their page order, and duplicate-only pages still advance the cursor.
|
||||
|
||||
- 🧪 **DSH 0.2.3-alpha.2 (alpha line)**: the 14 DSH peers and `engines.dsh` move to `0.2.3-alpha.2`, with the Cordis line at `4.2.0-alpha.1`. The host removed `@deepseek-ai/dsh-llm`'s `./brand` subpath, so the type now comes from `./types`, and the projection authority moved from `working-directory/change` to `workspace-root/change` — side-chat cwd stamps and worktree following moved with it. Every older-host compatibility branch is gone too (the `requestRejection` admission fallback, the legacy directory event, the old `data-slot` anchor and the `getOrigin` probe): this build serves 0.2.3-alpha.2+ only, and older hosts stay on v0.33.0.
|
||||
|
||||
- 🎛️ **Compact selection menus**: action menus use a smaller width than translation results. Rewrite opens a lateral flyout on hover, click or keyboard, flipping sides to fit; narrow screens keep the flyout with partial parent overlap. Translation results place Back and Copy together in a bottom bar, with long text scrolling separately.
|
||||
|
||||
@@ -245,10 +245,14 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
|
||||
}
|
||||
if (controller.signal.aborted || gen !== generation.current) return
|
||||
if (!append) setLinearFallback(fallback)
|
||||
const next = append && previous ? {
|
||||
...result,
|
||||
entries: [...previous.entries, ...result.entries.filter(entry => !previous.entries.some(old => old.hashFull === entry.hashFull))],
|
||||
} : result
|
||||
let next = result
|
||||
if (append && previous) {
|
||||
const previousHashes = new Set(previous.entries.map(entry => entry.hashFull))
|
||||
next = {
|
||||
...result,
|
||||
entries: [...previous.entries, ...result.entries.filter(entry => !previousHashes.has(entry.hashFull))],
|
||||
}
|
||||
}
|
||||
pageRef.current = next
|
||||
setPage(next)
|
||||
setBranches(next.branches)
|
||||
|
||||
@@ -527,6 +527,40 @@ describe('graph end-sentinel auto-load', () => {
|
||||
expect(mounted.container.textContent).toContain('subject b')
|
||||
} finally { mounted.unmount(); io.restore() }
|
||||
})
|
||||
it('deduplicates across pages by full hash and advances past duplicate-only pages', async () => {
|
||||
const original = entry(HASH_A)
|
||||
const repeated = { ...original, subject: 'Repeated commit from a later page' }
|
||||
const sameShortHash = entry(`${original.hash}${'2'.repeat(33)}`)
|
||||
const graph = vi.spyOn(api, 'gitGraph')
|
||||
.mockResolvedValueOnce({ ...graphPage([original]), hasMore: true, nextCursor: 'cursor-2' })
|
||||
.mockResolvedValueOnce({ ...graphPage([repeated, sameShortHash, entry(HASH_B)]), hasMore: true, nextCursor: 'cursor-3' })
|
||||
.mockResolvedValueOnce({ ...graphPage([sameShortHash, repeated]), hasMore: true, nextCursor: 'cursor-4' })
|
||||
.mockResolvedValueOnce(graphPage([repeated]))
|
||||
const io = installIntersectionObserver()
|
||||
const mounted = renderRoot(createElement(GitGraphSection, defaults))
|
||||
const rowHashes = () => [...mounted.container.querySelectorAll<HTMLElement>('[data-graph-commit]')]
|
||||
.map(row => row.dataset.graphCommit)
|
||||
try {
|
||||
await flush()
|
||||
await intersect(io.observers.at(-1)!)
|
||||
expect(rowHashes()).toEqual([HASH_A, sameShortHash.hashFull, HASH_B])
|
||||
expect(mounted.container.textContent).toContain(original.subject)
|
||||
expect(mounted.container.textContent).not.toContain(repeated.subject)
|
||||
|
||||
const duplicatePageObserver = io.observers.at(-1)!
|
||||
await intersect(duplicatePageObserver)
|
||||
expect(rowHashes()).toEqual([HASH_A, sameShortHash.hashFull, HASH_B])
|
||||
expect(mounted.container.querySelector('[data-graph-sentinel]')).not.toBeNull()
|
||||
expect(duplicatePageObserver.disconnected).toBe(true)
|
||||
const finalPageObserver = io.observers.at(-1)!
|
||||
expect(finalPageObserver).not.toBe(duplicatePageObserver)
|
||||
|
||||
await intersect(finalPageObserver)
|
||||
expect(graph.mock.calls.map(call => call[1]?.cursor)).toEqual([undefined, 'cursor-2', 'cursor-3', 'cursor-4'])
|
||||
expect(rowHashes()).toEqual([HASH_A, sameShortHash.hashFull, HASH_B])
|
||||
expect(mounted.container.querySelector('[data-graph-sentinel]')).toBeNull()
|
||||
} finally { mounted.unmount(); io.restore() }
|
||||
})
|
||||
it('ignores a second intersection while an append is already in flight', async () => {
|
||||
let resolveAppend!: (value: ReturnType<typeof page>) => void
|
||||
const graph = vi.spyOn(api, 'gitGraph').mockResolvedValueOnce(page('a', true)).mockImplementationOnce(() => new Promise(yes => { resolveAppend = yes })).mockResolvedValue(page('c'))
|
||||
|
||||
Reference in new issue
Block a user