️ perf(frontend): 优化长时运行下的搜索与缓存占用

- 为 V2 cmd+k 搜索预建索引并限制初始/宽泛结果数量
- 清理冷数据库树和 DataViewer 长生命周期快照缓存
- 收紧运行时 SQL 日志预算并在 hydration 时压缩旧缓存
This commit is contained in:
Syngnat
2026-06-22 22:36:39 +08:00
parent 05e8dab710
commit 8f1e6cf379
10 changed files with 506 additions and 134 deletions

View File

@@ -164,6 +164,14 @@ describe('DataViewer safe editing locator', () => {
expect(source).toContain('data_viewer.sql_log.phase.sort_buffer_retry');
});
it('caps viewer filter snapshots so long-running sessions do not retain unbounded table state', () => {
const source = readFileSync(new URL('./DataViewer.tsx', import.meta.url), 'utf8');
expect(source).toContain('const MAX_VIEWER_FILTER_SNAPSHOTS = 64;');
expect(source).toContain('const trimViewerFilterSnapshots = () => {');
expect(source).toContain('setViewerFilterSnapshot(normalizedTabId, {');
});
it('enables table preview editing after primary keys are loaded', async () => {
backendApp.DBGetColumns.mockResolvedValue({
success: true,