From 856c8a68ea4f769878fb1ffb901597582dadc19e Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 21 Aug 2025 13:34:04 +0200 Subject: [PATCH] =?UTF-8?q?[Perf]=20Default=20animation=20level:=202=20?= =?UTF-8?q?=E2=86=92=201=20(follow-up)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/left/settings/SettingsPerformance.tsx | 2 +- src/global/actions/ui/settings.ts | 1 + src/global/cache.ts | 8 +++----- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/left/settings/SettingsPerformance.tsx b/src/components/left/settings/SettingsPerformance.tsx index c19e2a331..29a932a93 100644 --- a/src/components/left/settings/SettingsPerformance.tsx +++ b/src/components/left/settings/SettingsPerformance.tsx @@ -139,7 +139,7 @@ function SettingsPerformance({ ? INITIAL_PERFORMANCE_STATE_MIN : (newLevel === ANIMATION_LEVEL_MED ? INITIAL_PERFORMANCE_STATE_MED : INITIAL_PERFORMANCE_STATE_MAX); - setSharedSettingOption({ animationLevel: newLevel as AnimationLevel }); + setSharedSettingOption({ animationLevel: newLevel as AnimationLevel, wasAnimationLevelSetManually: true }); updatePerformanceSettings(performance); }, []); diff --git a/src/global/actions/ui/settings.ts b/src/global/actions/ui/settings.ts index 3094dce3e..47b6e9480 100644 --- a/src/global/actions/ui/settings.ts +++ b/src/global/actions/ui/settings.ts @@ -130,6 +130,7 @@ addActionHandler('updatePerformanceSettings', (global, actions, payload): Action ...settings.performance, ...payload, }, + wasAnimationLevelSetManually: true, }); return global; diff --git a/src/global/cache.ts b/src/global/cache.ts index d63359e48..b919e1059 100644 --- a/src/global/cache.ts +++ b/src/global/cache.ts @@ -34,7 +34,7 @@ import { encryptSession } from '../util/passcode'; import { onBeforeUnload, throttle } from '../util/schedulers'; import { hasStoredSession } from '../util/sessions'; import { addActionHandler, getGlobal } from './index'; -import { INITIAL_GLOBAL_STATE } from './initialState'; +import { INITIAL_GLOBAL_STATE, INITIAL_PERFORMANCE_STATE_MED } from './initialState'; import { clearGlobalForLockScreen, clearSharedStateForLockScreen } from './reducers'; import { selectChatLastMessageId, @@ -351,11 +351,9 @@ function unsafeMigrateCache(cached: GlobalState, initialState: GlobalState) { } const cachedSharedSettings = cached.sharedState.settings; - if ( - cachedSharedSettings.animationLevel !== ANIMATION_LEVEL_DEFAULT - && !cachedSharedSettings.wasAnimationLevelSetManually - ) { + if (!cachedSharedSettings.wasAnimationLevelSetManually) { cachedSharedSettings.animationLevel = ANIMATION_LEVEL_DEFAULT; + cachedSharedSettings.performance = INITIAL_PERFORMANCE_STATE_MED; } }