From dddc88458905919fc5f4ca0cd4422e89f67e5943 Mon Sep 17 00:00:00 2001 From: andrew000 <11490628+andrew000@users.noreply.github.com> Date: Wed, 22 Nov 2023 00:21:41 +0200 Subject: [PATCH] Refactor `HistoryManager` in `aiogram/fsm/scene.py` Removed condition that checked if 'history' is empty before calling 'update_data' in 'Scene'. --- aiogram/fsm/scene.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/aiogram/fsm/scene.py b/aiogram/fsm/scene.py index 89dca081..fe4de5c4 100644 --- a/aiogram/fsm/scene.py +++ b/aiogram/fsm/scene.py @@ -38,10 +38,7 @@ class HistoryManager: history = history[-self._size :] loggers.scene.debug("Push state=%s data=%s to history", state, data) - if not history: - await self._history_state.set_data({}) - else: - await self._history_state.update_data(history=history) + await self._history_state.update_data(history=history) async def pop(self) -> Optional[MemoryStorageRecord]: history_data = await self._history_state.get_data()