From 2510f679b8c0294507bdde0aa50282b59eaa477e Mon Sep 17 00:00:00 2001 From: ghsuvr123 Date: Sun, 16 Aug 2020 14:41:15 +0300 Subject: [PATCH 1/2] Scroll console to bottom bug fixed --- client/modules/IDE/components/Console.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/modules/IDE/components/Console.jsx b/client/modules/IDE/components/Console.jsx index 749caaaa..9bf6abdf 100644 --- a/client/modules/IDE/components/Console.jsx +++ b/client/modules/IDE/components/Console.jsx @@ -87,6 +87,8 @@ const Console = () => { }, [theme, fontSize]); const cm = useRef({}); + const scrollConsoleDown = () => { cm.current.scrollTop = cm.current.scrollHeight; console.log('scroll'); }; + scrollConsoleDown(); const consoleClass = classNames({ 'preview-console': true, From ba0794ab5ab2f1bcc2008a3e18117e4f41fbc808 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Mon, 17 Aug 2020 15:55:34 -0400 Subject: [PATCH 2/2] Move console scroll to useDidUpdate --- client/modules/IDE/components/Console.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/modules/IDE/components/Console.jsx b/client/modules/IDE/components/Console.jsx index 9bf6abdf..ddb6d55e 100644 --- a/client/modules/IDE/components/Console.jsx +++ b/client/modules/IDE/components/Console.jsx @@ -87,8 +87,8 @@ const Console = () => { }, [theme, fontSize]); const cm = useRef({}); - const scrollConsoleDown = () => { cm.current.scrollTop = cm.current.scrollHeight; console.log('scroll'); }; - scrollConsoleDown(); + + useDidUpdate(() => { cm.current.scrollTop = cm.current.scrollHeight; }); const consoleClass = classNames({ 'preview-console': true,