From f748891b4b5d8e428221c3e01b1a103a2bb92fda Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 6 Apr 2019 19:22:24 -0700 Subject: [PATCH] Fixed: Ensure loading message doesn't change on re-render --- frontend/src/Components/Loading/LoadingMessage.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/Components/Loading/LoadingMessage.js b/frontend/src/Components/Loading/LoadingMessage.js index f080731c3..8c14ef0e1 100644 --- a/frontend/src/Components/Loading/LoadingMessage.js +++ b/frontend/src/Components/Loading/LoadingMessage.js @@ -22,9 +22,13 @@ const messages = [ 'Loading Battlestation' ]; +let message = null; + function LoadingMessage() { - const index = Math.floor(Math.random() * messages.length); - const message = messages[index]; + if (!message) { + const index = Math.floor(Math.random() * messages.length); + message = messages[index]; + } return (