From fe16510e9066862fcfcbbdaa7ee6bf062b2fc9fb Mon Sep 17 00:00:00 2001 From: Toby Zerner <toby.zerner@gmail.com> Date: Tue, 28 Jul 2015 22:57:58 +0930 Subject: [PATCH] Prevent flicker when editing a post --- js/forum/src/components/CommentPost.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/forum/src/components/CommentPost.js b/js/forum/src/components/CommentPost.js index 8bae5813c..487b285a8 100644 --- a/js/forum/src/components/CommentPost.js +++ b/js/forum/src/components/CommentPost.js @@ -81,7 +81,7 @@ export default class CommentPost extends Post { // Every 50ms, if the composer content has changed, then update the post's // body with a preview. let preview; - const updateInterval = setInterval(() => { + const updatePreview = () => { const content = app.composer.component.content(); if (preview === content) return; @@ -89,8 +89,10 @@ export default class CommentPost extends Post { preview = content; s9e.TextFormatter.preview(preview || '', element); - }, 50); + }; + updatePreview(); + const updateInterval = setInterval(updatePreview, 50); context.onunload = () => clearInterval(updateInterval); }