Skip to content

Commit 77ba2d3

Browse files
committed
Fix toggle of sidebar layout
1 parent 0d2b00f commit 77ba2d3

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

llms/ui/ctx.mjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,20 @@ export class AppContext {
299299
}
300300
togglePath(path, { left = true } = {}) {
301301
const currentPath = this.router.currentRoute.value?.path
302-
console.log('togglePath', path, currentPath, left)
303-
if (currentPath != path) {
302+
const isSamePath = currentPath === path
303+
console.log('togglePath', path, currentPath, left, isSamePath)
304+
if (!isSamePath) {
304305
this.router.push({ path })
305306
}
306-
if (left !== undefined) {
307-
this.toggleLayout('left', left)
307+
// When navigating to a new path, show sidebar (left=true)
308+
// When clicking on same path, toggle the sidebar (left=undefined)
309+
const toggleValue = isSamePath ? undefined : left
310+
if (toggleValue !== undefined) {
311+
this.toggleLayout('left', toggleValue)
312+
} else {
313+
this.toggleLayout('left') // toggle
308314
}
309-
return left
315+
return this.layoutVisible('left')
310316
}
311317
setThreadHeaders(components) {
312318
Object.assign(this.threadHeaderComponents, components)

0 commit comments

Comments
 (0)