From ea6a860b4f5b70cdcc40f35bfd09269926d26024 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 19 Oct 2022 00:46:37 -0400 Subject: [PATCH] Hypothetical fix for random images --- .../tts/tts_model_list/TtsModelListPage.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/fakeyou/src/v2/view/tts/tts_model_list/TtsModelListPage.tsx b/packages/fakeyou/src/v2/view/tts/tts_model_list/TtsModelListPage.tsx index d60cae1889..66c9d492e0 100644 --- a/packages/fakeyou/src/v2/view/tts/tts_model_list/TtsModelListPage.tsx +++ b/packages/fakeyou/src/v2/view/tts/tts_model_list/TtsModelListPage.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useCallback, useState } from "react"; +import React, { useEffect, useCallback, useState, useMemo } from "react"; import { Link } from "react-router-dom"; import { SessionTtsInferenceResultListFc } from "../../_common/SessionTtsInferenceResultsListFc"; import { SessionTtsModelUploadResultListFc } from "../../_common/SessionTtsModelUploadResultsListFc"; @@ -109,6 +109,15 @@ function TtsModelListPage(props: Props) { setMaybeSelectedTtsModel, } = props; + const images = [ + "mascot/halloween_1.webp", + "mascot/halloween_2.webp", + "mascot/halloween_3.webp", + "mascot/kitsune_pose2.webp", + ]; + + const randomImage = useMemo(() => images[Math.floor(Math.random() * images.length)], []); + const [maybeTtsError, setMaybeTtsError] = useState< GenerateTtsAudioErrorType | undefined >(undefined); @@ -321,15 +330,6 @@ function TtsModelListPage(props: Props) { ); } - const images = [ - "mascot/halloween_1.webp", - "mascot/halloween_2.webp", - "mascot/halloween_3.webp", - "mascot/kitsune_pose2.webp", - ]; - - const randomImage = images[Math.floor(Math.random() * images.length)]; - return ( {bootstrapLanguageNotice}