From 5c9a29547f0e664a36bbc31e8208bac82dc2f6c6 Mon Sep 17 00:00:00 2001 From: p82o <64755699+p82o@users.noreply.github.com> Date: Sat, 10 Apr 2021 01:05:13 +0300 Subject: [PATCH] Update fsm.py --- aiogram/contrib/middlewares/fsm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aiogram/contrib/middlewares/fsm.py b/aiogram/contrib/middlewares/fsm.py index 7e1c1be0..485a9f06 100644 --- a/aiogram/contrib/middlewares/fsm.py +++ b/aiogram/contrib/middlewares/fsm.py @@ -57,12 +57,13 @@ class FSMSStorageProxy(dict): self._is_dirty = True async def save(self, force=False): - if self._copy != dict(self) or force: + data = dict(self) + if self._copy != data or force: await self.fsm_context.set_data(data=self) if self._is_dirty or force: await self.fsm_context.set_state(self.state) self._is_dirty = False - self._copy = copy.deepcopy(dict(self)) + self._copy = copy.deepcopy(data) def __str__(self): s = super().__str__()