1- import { useEffect } from 'react'
1+ import { useContext , useEffect } from 'react'
22import { useDispatch , useSelector } from 'react-redux'
33import { useLocation } from 'react-router-dom'
44import { isNumber } from 'lodash'
55import { BrowserStorageItem , FeatureFlags , Theme } from 'uiSrc/constants'
66import { BuildType } from 'uiSrc/constants/env'
77import { 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'
139
1410import {
1511 appFeatureFlagsFeaturesSelector ,
@@ -44,6 +40,7 @@ import { fetchProfile } from 'uiSrc/slices/oauth/cloud'
4440import { fetchDBSettings } from 'uiSrc/slices/app/db-settings'
4541import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
4642import { DatabaseSettingsData } from 'uiSrc/slices/interfaces'
43+ import { ThemeContext } from 'uiSrc/contexts/themeContext'
4744
4845const SETTINGS_PAGE_PATH = '/settings'
4946const Config = ( ) => {
@@ -54,6 +51,7 @@ const Config = () => {
5451 [ FeatureFlags . cloudSso ] : cloudSsoFeature ,
5552 [ FeatureFlags . envDependent ] : envDependentFeature ,
5653 } = useSelector ( appFeatureFlagsFeaturesSelector )
54+ const { changeTheme } = useContext ( ThemeContext )
5755 const { pathname } = useLocation ( )
5856
5957 const dispatch = useDispatch ( )
@@ -211,7 +209,7 @@ const Config = () => {
211209 const checkAndSetTheme = ( ) => {
212210 const theme = config ?. theme
213211 if ( theme && localStorageService . get ( BrowserStorageItem . theme ) !== theme )
214- themeService . applyTheme ( theme as Theme )
212+ changeTheme ( theme )
215213 }
216214
217215 return null
0 commit comments