diff --git a/src/stores/questions/actions.ts b/src/stores/questions/actions.ts index 9d577920..b8a7b6fe 100644 --- a/src/stores/questions/actions.ts +++ b/src/stores/questions/actions.ts @@ -267,6 +267,8 @@ export const updateQuestion = async ( ); const request = async () => { + const rollbackQuestions = useQuestionsStore.getState(); + const q = useQuestionsStore.getState().questions.find((q) => q.id === questionId) || useQuestionsStore @@ -300,6 +302,8 @@ export const updateQuestion = async ( } catch (error) { if (isAxiosCanceledError(error)) return; + useQuestionsStore.setState(rollbackQuestions); + devlog("Error editing question", { error, questionId }); enqueueSnackbar("Не удалось сохранить вопрос"); }