fix sidebar disappearing on spa navigation to /teams/new
This commit is contained in:
parent
59db1ec054
commit
30a1c2dc65
1 changed files with 22 additions and 2 deletions
|
|
@ -39,10 +39,16 @@ class SidebarStore {
|
||||||
/** The pane stack for sidebar navigation */
|
/** The pane stack for sidebar navigation */
|
||||||
paneStack = new PaneStackStore()
|
paneStack = new PaneStackStore()
|
||||||
|
|
||||||
|
/** Timeout ID for delayed pane stack clear after close animation */
|
||||||
|
private clearTimeoutId: ReturnType<typeof setTimeout> | null = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the sidebar with a snippet content (legacy API)
|
* Open the sidebar with a snippet content (legacy API)
|
||||||
*/
|
*/
|
||||||
open(title?: string, content?: Snippet, scrollable = true) {
|
open(title?: string, content?: Snippet, scrollable = true) {
|
||||||
|
// Cancel any pending clear from a previous close()
|
||||||
|
this.cancelPendingClear()
|
||||||
|
|
||||||
// For snippet content, we don't use the pane stack
|
// For snippet content, we don't use the pane stack
|
||||||
// This is for backwards compatibility
|
// This is for backwards compatibility
|
||||||
this.state.open = true
|
this.state.open = true
|
||||||
|
|
@ -59,6 +65,9 @@ class SidebarStore {
|
||||||
props?: Record<string, any>,
|
props?: Record<string, any>,
|
||||||
options?: OpenWithComponentOptions | boolean
|
options?: OpenWithComponentOptions | boolean
|
||||||
) {
|
) {
|
||||||
|
// Cancel any pending clear from a previous close()
|
||||||
|
this.cancelPendingClear()
|
||||||
|
|
||||||
// Handle backward compatibility where 4th param was scrollable boolean
|
// Handle backward compatibility where 4th param was scrollable boolean
|
||||||
const opts: OpenWithComponentOptions =
|
const opts: OpenWithComponentOptions =
|
||||||
typeof options === 'boolean' ? { scrollable: options } : options ?? {}
|
typeof options === 'boolean' ? { scrollable: options } : options ?? {}
|
||||||
|
|
@ -112,12 +121,23 @@ class SidebarStore {
|
||||||
close() {
|
close() {
|
||||||
this.state.open = false
|
this.state.open = false
|
||||||
this.state.activeItemId = undefined
|
this.state.activeItemId = undefined
|
||||||
// Clear pane stack after animation
|
// Clear pane stack after animation completes
|
||||||
setTimeout(() => {
|
this.clearTimeoutId = setTimeout(() => {
|
||||||
this.paneStack.clear()
|
this.paneStack.clear()
|
||||||
|
this.clearTimeoutId = null
|
||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel any pending pane stack clear from a previous close()
|
||||||
|
*/
|
||||||
|
private cancelPendingClear() {
|
||||||
|
if (this.clearTimeoutId) {
|
||||||
|
clearTimeout(this.clearTimeoutId)
|
||||||
|
this.clearTimeoutId = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle the sidebar open/close state
|
* Toggle the sidebar open/close state
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue