From 95fb194a969737512592f91ab2aea478ee8193d0 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 4 May 2024 14:33:14 +0300 Subject: [PATCH] condition0fix --- src/components/Views/EditView/EditView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Views/EditView/EditView.tsx b/src/components/Views/EditView/EditView.tsx index c9e03455..ee98e794 100644 --- a/src/components/Views/EditView/EditView.tsx +++ b/src/components/Views/EditView/EditView.tsx @@ -69,7 +69,7 @@ export const EditView = (props: Props) => { const shoutTopics = props.shout.topics || [] const draft = getDraftFromLocalStorage(props.shout.id) - let draftForm = {} + let draftForm if (draft) { draftForm = Object.keys(draft).length !== 0 ? draft : { shoutId: props.shout.id } console.debug('draft from localstorage: ', draftForm) @@ -90,7 +90,7 @@ export const EditView = (props: Props) => { } console.debug('draft from props data: ', draftForm) } - setForm(draftForm) + draftForm && setForm(draftForm) const subtitleInput: { current: HTMLTextAreaElement } = { current: null } const [prevForm, setPrevForm] = createStore(clone(form))