Skip to content

Commit f1d4452

Browse files
nscuroGepardgame
andcommitted
Fix state of sidebar not being saved for non-SNAPSHOT versions
Ports DependencyTrack/frontend#1044 Co-authored-by: Thomas Schauer-Köckeis <[email protected]> Signed-off-by: nscuro <[email protected]>
1 parent 5094b72 commit f1d4452

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

src/containers/DefaultContainer.vue

+17-20
Original file line numberDiff line numberDiff line change
@@ -211,29 +211,26 @@ export default {
211211
mounted() {
212212
if (this.$dtrack && this.$dtrack.version.includes('SNAPSHOT')) {
213213
this.$root.$emit('bv::show::modal', 'snapshotModal');
214+
}
214215
215-
this.isSidebarMinimized =
216-
localStorage && localStorage.getItem('isSidebarMinimized') !== null
217-
? localStorage.getItem('isSidebarMinimized') === 'true'
218-
: false;
219-
const sidebar = document.body;
220-
if (sidebar) {
221-
if (this.isSidebarMinimized) {
222-
sidebar.classList.add('sidebar-minimized');
223-
} else {
224-
sidebar.classList.remove('sidebar-minimized');
225-
}
216+
this.isSidebarMinimized =
217+
localStorage && localStorage.getItem('isSidebarMinimized') !== null
218+
? localStorage.getItem('isSidebarMinimized') === 'true'
219+
: false;
220+
const sidebar = document.body;
221+
if (sidebar) {
222+
if (this.isSidebarMinimized) {
223+
sidebar.classList.add('sidebar-minimized');
224+
} else {
225+
sidebar.classList.remove('sidebar-minimized');
226226
}
227-
this.$nextTick(() => {
228-
const sidebarMinimizer = this.$el.querySelector('.sidebar-minimizer');
229-
if (sidebarMinimizer) {
230-
sidebarMinimizer.addEventListener(
231-
'click',
232-
this.handleMinimizedUpdate,
233-
);
234-
}
235-
});
236227
}
228+
this.$nextTick(() => {
229+
const sidebarMinimizer = this.$el.querySelector('.sidebar-minimizer');
230+
if (sidebarMinimizer) {
231+
sidebarMinimizer.addEventListener('click', this.handleMinimizedUpdate);
232+
}
233+
});
237234
},
238235
computed: {
239236
name() {

0 commit comments

Comments
 (0)