1
- import { useEffect } from 'react'
1
+ import { useContext , useEffect } from 'react'
2
2
import { useDispatch , useSelector } from 'react-redux'
3
3
import { useLocation } from 'react-router-dom'
4
4
import { isNumber } from 'lodash'
5
5
import { BrowserStorageItem , FeatureFlags , Theme } from 'uiSrc/constants'
6
6
import { BuildType } from 'uiSrc/constants/env'
7
7
import { BUILD_FEATURES } from 'uiSrc/constants/featuresHighlighting'
8
- import {
9
- localStorageService ,
10
- setObjectStorage ,
11
- themeService ,
12
- } from 'uiSrc/services'
8
+ import { localStorageService , setObjectStorage } from 'uiSrc/services'
13
9
14
10
import {
15
11
appFeatureFlagsFeaturesSelector ,
@@ -44,6 +40,7 @@ import { fetchProfile } from 'uiSrc/slices/oauth/cloud'
44
40
import { fetchDBSettings } from 'uiSrc/slices/app/db-settings'
45
41
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
46
42
import { DatabaseSettingsData } from 'uiSrc/slices/interfaces'
43
+ import { ThemeContext } from 'uiSrc/contexts/themeContext'
47
44
48
45
const SETTINGS_PAGE_PATH = '/settings'
49
46
const Config = ( ) => {
@@ -54,6 +51,7 @@ const Config = () => {
54
51
[ FeatureFlags . cloudSso ] : cloudSsoFeature ,
55
52
[ FeatureFlags . envDependent ] : envDependentFeature ,
56
53
} = useSelector ( appFeatureFlagsFeaturesSelector )
54
+ const { changeTheme } = useContext ( ThemeContext )
57
55
const { pathname } = useLocation ( )
58
56
59
57
const dispatch = useDispatch ( )
@@ -211,7 +209,7 @@ const Config = () => {
211
209
const checkAndSetTheme = ( ) => {
212
210
const theme = config ?. theme
213
211
if ( theme && localStorageService . get ( BrowserStorageItem . theme ) !== theme )
214
- themeService . applyTheme ( theme as Theme )
212
+ changeTheme ( theme )
215
213
}
216
214
217
215
return null
0 commit comments