Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.

perf: 异步化文件树读取与浏览器体验优化 - #127

Merged
sorrycc merged 4 commits into
masterfrom
feat/better_exp
Feb 12, 2026
Merged

perf: 异步化文件树读取与浏览器体验优化#127
sorrycc merged 4 commits into
masterfrom
feat/better_exp

Conversation

@EndeLiu

@EndeLiu EndeLiu commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

文件变更摘要表

文件路径 变更类型 主要变更描述
src/main/plugins/fs/index.ts 修改 将同步的 getFileTree 调用改为异步调用
src/main/plugins/fs/tree.ts 修改 重构文件树构建逻辑,从同步改为异步并添加错误处理
src/renderer/components/Browser/NavBar.tsx 修改 添加可选的 inspect 按钮显示控制
src/renderer/components/ContentPanel/ContentTabBar.tsx 修改 为编辑器标签添加不可关闭功能
src/renderer/components/ContentPanel/panes/BrowserPane.tsx 修改 增强浏览器功能,添加空白页状态和导航改进
src/renderer/components/ContentPanel/useContentTabs.ts 修改 修改默认标签配置,添加浏览器标签
src/renderer/components/SecondarySidebar/FileTree.tsx 修改 优化文件树初始化逻辑,避免重复加载
src/renderer/components/TreeNode/index.css 删除 移除独立的 TreeNode 样式文件
src/renderer/components/TreeNode/index.tsx 修改 移除对已删除CSS文件的引用
src/renderer/styles/seti.css 修改 修复字体文件路径引用

执行摘要

本次变更主要围绕文件系统性能优化浏览器功能增强两大核心主题展开。主要改进包括:

  1. 异步文件树构建:将同步文件系统操作改为异步,提升应用响应性

  2. 浏览器用户体验优化:新增空白页状态、改进导航逻辑

  3. 标签管理改进:支持不可关闭的标签类型

  4. 代码清理:移除冗余样式文件,修复资源路径

功能分析

新功能

  1. 浏览器空白页状态:当没有URL时显示友好的引导界面

  2. 智能导航:支持从空白页返回历史记录的功能

  3. 标签保护机制:编辑器标签默认不可关闭

修改功能

  1. 文件树构建:从同步改为异步,支持错误处理和并行处理

  2. 浏览器导航栏:inspect按钮变为可选显示

  3. 默认标签配置:新增浏览器标签作为默认标签之一

移除功能

  1. 独立TreeNode样式:样式已整合到全局样式中

技术实现细节

异步文件系统重构

// 之前:同步操作
const files = fs.readdirSync(dirFilePath);
files.forEach((file) => {
  const stats = fs.statSync(filePath);
  // ... 同步处理
});
// 之后:异步操作 + 错误处理
const files = await fs.promises.readdir(dirFilePath);
const filePromises = files.map(async (file) => {
  try {
    const stats = await fs.promises.stat(filePath);
    // ... 异步处理
  } catch (error) {
    console.warn(`Error processing file ${filePath}:`, error);
    return null;
  }
});

浏览器导航改进

  • 空白页检测:新增 showBlankPage 状态管理

  • 智能回退:当无法后退时显示空白页而非禁用按钮

  • 前进逻辑:支持从空白页恢复到历史页面

标签管理增强

  • 不可关闭标签:通过 closable 属性控制

  • 默认标签顺序:调整为 [editor, terminal, browser]

影响评估

系统架构影响

  • 性能提升:异步文件操作减少主线程阻塞

  • 用户体验:浏览器功能更加完善和直观

  • 代码质量:移除冗余文件,统一样式管理

兼容性影响

  • 向后兼容:所有API变更均为内部实现,不影响外部接口

  • 文件路径:修复了字体文件路径,确保在不同环境下正常加载

开发工作流影响

  • 构建过程:无影响,所有路径引用已更新

@EndeLiu
EndeLiu requested a review from sorrycc February 11, 2026 10:49
@github-actions

github-actions Bot commented Feb 11, 2026

Copy link
Copy Markdown

Build Ready

Architecture Download DMG Size ZIP Size
Apple Silicon Download 105.32 MB 110.63 MB
Intel Download 108.56 MB 115.22 MB

@sorrycc
sorrycc merged commit 035af72 into master Feb 12, 2026
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants