Skip to content

Commit 8544f11

Browse files
feat(Navigation): remove legacy navigation setting support
1 parent 990a9fa commit 8544f11

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

src/containers/AsideNavigation/AsideNavigation.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useEffect, useState} from 'react';
1+
import React, {useState} from 'react';
22
import {connect} from 'react-redux';
33
import {useLocation} from 'react-router';
44
import {useHistory} from 'react-router-dom';
@@ -170,16 +170,6 @@ function AsideNavigation(props: AsideNavigationProps) {
170170
props.setSettingValue(ASIDE_HEADER_COMPACT_KEY, JSON.stringify(compact));
171171
};
172172

173-
// navigation managed its compact state internally before, and its approach is not compatible with settings
174-
// to migrate, save the incoming value again; save only `false` because `true` is the default value
175-
// assume it is safe to remove this code block if it is at least a few months old
176-
// there a two of these, search for a similar comment
177-
useEffect(() => {
178-
if (props.compact === false) {
179-
setIsCompact(props.compact);
180-
}
181-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
182-
183173
const menuItems: AsideHeaderMenuItem[] = React.useMemo(() => {
184174
const {pathname} = location;
185175
const isClusterPage = pathname === '/cluster';

src/store/reducers/settings.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ export function readSavedSettingsValue(key, defaultValue) {
2626
return savedValue ?? defaultValue;
2727
}
2828

29-
// navigation managed its compact state internally before, and its approach is not compatible with settings
30-
// try reading the old localStorage entry to use it as a default value, for backward compatibility
31-
// assume it is safe to remove this code block if it is at least a few months old
32-
// there a two of these, search for a similar comment
33-
let legacyAsideNavCompactState = '';
34-
try {
35-
legacyAsideNavCompactState = String(JSON.parse(getValueFromLS('nvAsideHeader')).isCompact);
36-
localStorage.removeItem('nvAsideHeader');
37-
} catch {}
38-
3929
export const initialState = {
4030
problemFilter: ALL,
4131
userSettings: {
@@ -53,10 +43,7 @@ export const initialState = {
5343
[SAVED_QUERIES_KEY]: readSavedSettingsValue(SAVED_QUERIES_KEY, '[]'),
5444
[TENANT_INITIAL_TAB_KEY]: readSavedSettingsValue(TENANT_INITIAL_TAB_KEY),
5545
[QUERY_INITIAL_MODE_KEY]: readSavedSettingsValue(QUERY_INITIAL_MODE_KEY, QueryModes.script),
56-
[ASIDE_HEADER_COMPACT_KEY]: readSavedSettingsValue(
57-
ASIDE_HEADER_COMPACT_KEY,
58-
legacyAsideNavCompactState || 'true',
59-
),
46+
[ASIDE_HEADER_COMPACT_KEY]: readSavedSettingsValue(ASIDE_HEADER_COMPACT_KEY, 'true'),
6047
[PARTITIONS_SELECTED_COLUMNS_KEY]: readSavedSettingsValue(PARTITIONS_SELECTED_COLUMNS_KEY),
6148
},
6249
systemSettings,

0 commit comments

Comments
 (0)