fix(host): cancelling a superseded path edit falls back to the single-pane level

A draft edit can invalidate the selection's preview request; Escape then
left selected set with no child and nothing loading — a half-empty
two-pane view. Cancel now clears the selection when no preview exists
(ds-review-bot round 7).
This commit is contained in:
creatixchu
2026-07-29 00:38:37 +08:00
parent 36be9f26db
commit b0d120efa8
2 changed files with 22 additions and 0 deletions

View File

@@ -328,6 +328,11 @@ export function DirectoryBrowser({ open, listDirectory, createDirectory, onOpen,
event.stopPropagation()
setPathDraft(null)
setError(null)
// Editing may have superseded the selection's preview
// request; a selection with no preview and nothing in
// flight would render a half-empty two-pane view, so
// cancel falls back to the single-pane level.
if (child === null && !loading) setSelected(null)
}
}}
/>