comment draft saving

This commit is contained in:
keyan 2022-01-07 12:55:40 -06:00
parent e42f1d6bb9
commit b6a530f5c4
3 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ export function CommentsHeader ({ handleSort }) {
}
return (
<Navbar className='py-0'>
<Navbar className='py-1'>
<Nav
className={styles.navbarNav}
activeKey={sort}

View File

@ -237,7 +237,6 @@ export function Form ({
onSubmit={async (...args) =>
onSubmit && onSubmit(...args).then(() => {
if (!storageKeyPrefix) return
console.log(...args)
Object.keys(...args).forEach(v =>
localStorage.removeItem(storageKeyPrefix + '-' + v))
}).catch(e => setError(e.message || e))}

View File

@ -13,7 +13,7 @@ export const CommentSchema = Yup.object({
})
export default function Reply ({ parentId, onSuccess, replyOpen }) {
const [reply, setReply] = useState(replyOpen)
const [reply, setReply] = useState(replyOpen || !!localStorage.getItem('reply-' + parentId + '-' + 'text'))
const me = useMe()
const [createComment] = useMutation(
@ -73,6 +73,7 @@ export default function Reply ({ parentId, onSuccess, replyOpen }) {
resetForm({ text: '' })
setReply(replyOpen || false)
}}
storageKeyPrefix={'reply-' + parentId}
>
<MarkdownInput
name='text'