Skip to content

Commit ede5bd8

Browse files
committed
[green] clear files during in-place reconnect
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th>
1 parent c3e1afa commit ede5bd8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎app/lib/files/file_explorer_controller.dart‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,18 @@ class FileExplorerController extends Notifier<FileExplorerState> {
344344
if (now == ConnState.ready && !_isAttached(prev)) {
345345
// A NEW board session became ready: auto-load its listing (FR-FILES-1).
346346
_init();
347-
} else if (now == ConnState.disconnected) {
347+
} else if (!_isAttached(now) && _isAttached(prev)) {
348348
// DEVICE_INFO and the initial listing belong to the attachment that
349349
// started them. Prevent either completion from publishing after detach.
350350
_initEpoch += 1;
351351
_listingEpoch += 1;
352-
// The board went away: drop the stale listing (the view shows the
353-
// disconnected guidance); the next connection re-roots via _init.
352+
_fsRoot = '/';
353+
// The attachment went away or began an in-place reconnect: drop every
354+
// stale path/listing before the successor session can be acted upon.
355+
// The next ready transition re-roots from DEVICE_INFO via _init.
354356
state = state.copyWith(
357+
fsRoot: '/',
358+
cwd: '/',
355359
entries: <RemoteEntry>[],
356360
loading: false,
357361
hasReportedFsRoot: false,

0 commit comments

Comments
 (0)