Skip to content

Commit

Permalink
Merge pull request #272 from ninokhonelia/feature-remember-previous-a…
Browse files Browse the repository at this point in the history
…ctive-tab

Feature: Remember previous active tab
  • Loading branch information
marcfil authored Sep 9, 2024
2 parents 235476c + 00ccccf commit 2880bdf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion resources/js/mixins/HasTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ export default {

const tabs = this.tabs = this.setTabs();
const routeTabs = parseLocationHash();
const currentTabSlug = routeTabs[this.getTabsReference()];
var currentTabSlug = routeTabs[this.getTabsReference()];

if(sessionStorage.hasOwnProperty(this.getTabsReference())){
currentTabSlug = sessionStorage.getItem(this.getTabsReference());
}

if (tabs[currentTabSlug]) {
this.handleTabClick(tabs[currentTabSlug])
Expand Down Expand Up @@ -216,6 +220,7 @@ export default {
setLocationHash() {
const routeTabs = parseLocationHash()
routeTabs[this.getTabsReference()] = this.selectedTab.slug;
sessionStorage.setItem(this.getTabsReference(), this.selectedTab.slug)
updateLocationHash(routeTabs)
},

Expand Down

0 comments on commit 2880bdf

Please sign in to comment.