From 39dd78e25da8e458a4f8729199d16abbf1d87e0e Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 4 May 2024 14:39:05 +0300 Subject: [PATCH] checkfix --- src/components/Views/EditView/EditView.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Views/EditView/EditView.tsx b/src/components/Views/EditView/EditView.tsx index ee98e794..1e8650b1 100644 --- a/src/components/Views/EditView/EditView.tsx +++ b/src/components/Views/EditView/EditView.tsx @@ -69,12 +69,13 @@ export const EditView = (props: Props) => { const shoutTopics = props.shout.topics || [] const draft = getDraftFromLocalStorage(props.shout.id) - let draftForm + if (draft) { - draftForm = Object.keys(draft).length !== 0 ? draft : { shoutId: props.shout.id } + const draftForm = Object.keys(draft).length !== 0 ? draft : { shoutId: props.shout.id } + setForm(draftForm) console.debug('draft from localstorage: ', draftForm) } else { - draftForm = { + const draftForm = { slug: props.shout.slug, shoutId: props.shout.id, title: props.shout.title, @@ -88,9 +89,10 @@ export const EditView = (props: Props) => { media: props.shout.media, layout: props.shout.layout, } + setForm(draftForm) console.debug('draft from props data: ', draftForm) } - draftForm && setForm(draftForm) + const subtitleInput: { current: HTMLTextAreaElement } = { current: null } const [prevForm, setPrevForm] = createStore(clone(form))