⚡ perf(vscode): 预览切走标签页时页面留着,切回来不再重新生成、重发文档和整份重画

This commit is contained in:
cruldra committed 2026-10-13 13:17:22 +11:00
1 parent 53283808a0
commit 5426c50cd9
8 files changed
+118 -59

No files matched your search

@@ -9,7 +9,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { App } from './App'
import { createViewStateStore } from './viewState'
/** 扩展端那头:页面发出去的消息、页面挂着的收消息回调,以及 webview 自己存的状态(标签页切回来页面重新加载时还在) */
/** 扩展端那头:页面发出去的消息、页面挂着的收消息回调,以及 webview 自己存的状态(页面重新加载时还在) */
const host = vi.hoisted(() => ({
posted: [] as unknown[],
listeners: new Set<(msg: unknown) => void>(),
@@ -99,7 +99,7 @@ afterEach(async () => {
vi.unstubAllGlobals()
})
describe('标签页切走再切回来,调用树弹框照旧开着', () => {
describe('页面重新加载后,调用树弹框照旧开着', () => {
it('弹框开着、选了第二个入口:页面重新加载拿到文档后重新打开那块、要它的树,停回第二个入口;关掉后再加载就不开了', async () => {
await load()
await deliver(documentOf(3, [block('0', 'mask_phone')]))
@@ -127,7 +127,7 @@ describe('标签页切走再切回来,调用树弹框照旧开着', () => {
expect(host.posted).not.toContainEqual(expect.objectContaining({ type: 'openCallTree' }))
})
it('页面重新加载前切走、文档还没到又切走一次,记着的弹框还在', async () => {
it('重新加载后文档还没到,页面又重新加载了一次:记着的弹框还在', async () => {
saved = { editing: [], folds: {}, callTree: { anchor: 'mask_phone', entry: 1 } }
await load()
await unload()