Skip to content

Commit

Permalink
Merge pull request #1044 from nscuro/backport-pr-1032
Browse files Browse the repository at this point in the history
Backport: Fix state of sidebar not being saved for non-`SNAPSHOT` versions
  • Loading branch information
nscuro authored Oct 9, 2024
2 parents 1bff520 + e830d5d commit 5232432
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/containers/DefaultContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,29 +202,26 @@ export default {
mounted() {
if (this.$dtrack && this.$dtrack.version.includes('SNAPSHOT')) {
this.$root.$emit('bv::show::modal', 'snapshotModal');
}
this.isSidebarMinimized =
localStorage && localStorage.getItem('isSidebarMinimized') !== null
? localStorage.getItem('isSidebarMinimized') === 'true'
: false;
const sidebar = document.body;
if (sidebar) {
if (this.isSidebarMinimized) {
sidebar.classList.add('sidebar-minimized');
} else {
sidebar.classList.remove('sidebar-minimized');
}
this.isSidebarMinimized =
localStorage && localStorage.getItem('isSidebarMinimized') !== null
? localStorage.getItem('isSidebarMinimized') === 'true'
: false;
const sidebar = document.body;
if (sidebar) {
if (this.isSidebarMinimized) {
sidebar.classList.add('sidebar-minimized');
} else {
sidebar.classList.remove('sidebar-minimized');
}
this.$nextTick(() => {
const sidebarMinimizer = this.$el.querySelector('.sidebar-minimizer');
if (sidebarMinimizer) {
sidebarMinimizer.addEventListener(
'click',
this.handleMinimizedUpdate,
);
}
});
}
this.$nextTick(() => {
const sidebarMinimizer = this.$el.querySelector('.sidebar-minimizer');
if (sidebarMinimizer) {
sidebarMinimizer.addEventListener('click', this.handleMinimizedUpdate);
}
});
},
computed: {
name() {
Expand Down

0 comments on commit 5232432

Please sign in to comment.