From 7bcea832cdd2391369c66a831d43036ebd82bdea Mon Sep 17 00:00:00 2001 From: Debanshu Kundu Date: Wed, 25 Jan 2017 17:48:35 +0530 Subject: #4967 Fixed issue of post not getting updated after edit, if the post was focused. (#5149) --- webapp/components/edit_post_modal.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/edit_post_modal.jsx b/webapp/components/edit_post_modal.jsx index 7c1747ef7..b2b607428 100644 --- a/webapp/components/edit_post_modal.jsx +++ b/webapp/components/edit_post_modal.jsx @@ -93,7 +93,9 @@ export default class EditPostModal extends React.Component { updatedPost, () => { window.scrollTo(0, 0); - }); + }, + Boolean(PostStore.getFocusedPostId()) // If there is focused post we need to update that post's store too. + ); $('#edit_post').modal('hide'); } @@ -184,7 +186,10 @@ export default class EditPostModal extends React.Component { onModalHide() { if (this.state.refocusId !== '') { setTimeout(() => { - $(this.state.refocusId).get(0).focus(); + const element = $(this.state.refocusId).get(0); + if (element) { + element.focus(); + } }); } } -- cgit v1.2.3-1-g7c22