文件: tui/app.rs:144-190 分类: 状态一致性
tui/app.rs:144-190
问题: load_file 先清空 watcher,如果打开失败,旧 loading_state 和 file_path 残留,watcher 已丢失。
load_file
loading_state
file_path
建议修复: 先暂存新状态,成功后原子替换;失败时完整保留旧状态或转 Error 状态。
已修复 — commit 967c11f
967c11f
根因:load_file 在第154行先清空 file_watcher,如果后续 ProgressiveFileReader::open 失败,? 提前返回导致 watcher 丢失,而 loading_state 和 file_path 仍残留旧值。
file_watcher
ProgressiveFileReader::open
?
修复方式:重构为 build-then-swap 模式:
测试:test_file_watcher_preserved_on_nonexistent_file 验证失败后 watcher、file_path、loading_state 均保留。全量 129 tests 通过。
test_file_watcher_preserved_on_nonexistent_file
No dependencies set.
The note is not visible to the blocked user.
文件:
tui/app.rs:144-190分类: 状态一致性
问题:
load_file先清空 watcher,如果打开失败,旧loading_state和file_path残留,watcher 已丢失。建议修复: 先暂存新状态,成功后原子替换;失败时完整保留旧状态或转 Error 状态。
已修复 — commit
967c11f根因:
load_file在第154行先清空file_watcher,如果后续ProgressiveFileReader::open失败,?提前返回导致 watcher 丢失,而loading_state和file_path仍残留旧值。修复方式:重构为 build-then-swap 模式:
测试:
test_file_watcher_preserved_on_nonexistent_file验证失败后 watcher、file_path、loading_state 均保留。全量 129 tests 通过。