diff --git a/app/controllers/search.js b/app/controllers/search.js index 909f161..b0dc644 100644 --- a/app/controllers/search.js +++ b/app/controllers/search.js @@ -33,7 +33,9 @@ export default class SearchController extends Controller { // 2. If it's a back navigation to the exact same search, resolve instantly with no animation if (isSameSearch && hasResults) { - this.mapUi.showSidebar(); + if (this.mapUi.isSidebarVisible) { + this.mapUi.showSidebar(); + } return; } diff --git a/app/templates/application.gjs b/app/templates/application.gjs index b4cdf5e..7259654 100644 --- a/app/templates/application.gjs +++ b/app/templates/application.gjs @@ -55,6 +55,14 @@ export default class ApplicationComponent extends Component { this.mapUi.hideSidebar(); if (name === 'menu' || name.startsWith('lists')) { this.router.transitionTo('index'); + } else if (name === 'place') { + if (this.mapUi.returnToSearch && this.mapUi.currentSearch) { + this.router.transitionTo('search', { + queryParams: this.mapUi.currentSearch, + }); + } else { + this.router.transitionTo('index'); + } } } } diff --git a/app/templates/place.gjs b/app/templates/place.gjs index eb76a0f..f3aa959 100644 --- a/app/templates/place.gjs +++ b/app/templates/place.gjs @@ -104,6 +104,13 @@ export default class PlaceTemplate extends Component { close() { this.mapUi.clearSelection(); this.mapUi.hideSidebar(); + if (this.mapUi.returnToSearch && this.mapUi.currentSearch) { + this.router.transitionTo('search', { + queryParams: this.mapUi.currentSearch, + }); + } else { + this.router.transitionTo('index'); + } }