fix(host,client): default-export the picker seam; invalidate stale kind reads
ds-review-bot round 3. The seam package broke the service-package export contract (named export only), so the config catalog filed it under Other libraries and default imports failed; it now default-exports DirectoryPicker like every abstract seam, and the regenerated catalog lists it as one. The picker-kind effect also let a settlement from a superseded flow open leak into the current one (close/reopen mid-describe, or a reconnect that swaps the backend): the read now resets the affordance on every open and a cleanup-toggled flag discards obsolete settlements, both directions pinned by jsdom races.
This commit is contained in:
@@ -80,12 +80,18 @@ export function WorkspaceCreateFlow({
|
||||
const [dialogPicker, setDialogPicker] = useState(false)
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
// Reset before each read: a reconnect can change the composed backend, so
|
||||
// a previous open's answer must not leak into this one; and a settlement
|
||||
// from a superseded open (flow closed, or a newer read started) is
|
||||
// discarded via the cleanup-toggled flag.
|
||||
setDialogPicker(false)
|
||||
let stale = false
|
||||
void directoryPickerKind()
|
||||
.then((kind) => { setDialogPicker(kind === 'dialog') })
|
||||
.then((kind) => { if (!stale) setDialogPicker(kind === 'dialog') })
|
||||
// A failed describe hides the entry too: the same Host that cannot
|
||||
// answer describe cannot serve pickDirectory. (Post-unmount settlement
|
||||
// is safe: React 18 no-ops setState on unmounted components.)
|
||||
.catch(() => { setDialogPicker(false) })
|
||||
// answer describe cannot serve pickDirectory.
|
||||
.catch(() => { if (!stale) setDialogPicker(false) })
|
||||
return () => { stale = true }
|
||||
}, [open, directoryPickerKind])
|
||||
|
||||
const items: MenuEntry[] = [
|
||||
|
||||
Reference in New Issue
Block a user