mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-24 03:16:43 +00:00
fix(web): collapse WorkspaceSheet switcher list when the sheet closes (IDEA-1720) (#711)
The inline workspace-switcher list state lives in WorkspaceSheet, which stays mounted while DockedSheet's children unmount — so an expanded list survived close/reopen of the mobile Workspace tab. Replace the plain $state with a reassignable $derived keyed on `open`: the card toggle still works by reassignment, and the list snaps back to collapsed on any open-state change, including backdrop/swipe dismissal that no handler in this component observes.
This commit is contained in:
@@ -43,7 +43,17 @@
|
||||
collectionStore.collections.filter((c) => agentSlugs.includes(c.slug))
|
||||
);
|
||||
|
||||
let switching = $state(false);
|
||||
// Inline switcher list expansion. Reassignable $derived (Svelte 5.25+)
|
||||
// instead of $state: the card's onclick toggles it by reassignment, and
|
||||
// it snaps back to collapsed whenever `open` changes. This state lives
|
||||
// here (not in DockedSheet's children, which unmount on close), so plain
|
||||
// $state would survive close/reopen and the list would come back stale —
|
||||
// including via backdrop/swipe dismissal, which no handler in this
|
||||
// component sees (IDEA-1720).
|
||||
let switching = $derived.by(() => {
|
||||
void open;
|
||||
return false;
|
||||
});
|
||||
|
||||
// Close on navigation (the switcher card navigates on select).
|
||||
afterNavigate((nav) => {
|
||||
|
||||
Reference in New Issue
Block a user