From e2a61619b07581808f0831fd43763cc0f3e8bc4c Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Mon, 15 Jan 2024 16:11:43 -0500 Subject: [PATCH] fix(striker-ui): remove mount status from dashboard --- striker-ui/pages/index.tsx | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/striker-ui/pages/index.tsx b/striker-ui/pages/index.tsx index 3b727915..59312b0f 100644 --- a/striker-ui/pages/index.tsx +++ b/striker-ui/pages/index.tsx @@ -1,7 +1,7 @@ import { Add as AddIcon } from '@mui/icons-material'; import { Box, Divider, Grid } from '@mui/material'; import Head from 'next/head'; -import { FC, useEffect, useRef, useState } from 'react'; +import { FC, useState } from 'react'; import API_BASE_URL from '../lib/consts/API_BASE_URL'; import { DIVIDER } from '../lib/consts/DEFAULT_THEME'; @@ -120,8 +120,6 @@ const filterServers = (allServers: ServerListItem[], searchTerm: string) => ); const Dashboard: FC = () => { - const componentMountedRef = useRef(true); - const [allServers, setAllServers] = useState([]); const [excludeServers, setExcludeServers] = useState([]); const [includeServers, setIncludeServers] = useState([]); @@ -136,10 +134,6 @@ const Dashboard: FC = () => { ) => { const { exclude, include } = filterServers(...filterArgs); - if (!componentMountedRef.current) { - return; - } - setExcludeServers(exclude); setIncludeServers(include); }; @@ -175,10 +169,6 @@ const Dashboard: FC = () => { const allServersWithScreenshots = [...serverListItems]; - if (!componentMountedRef.current) { - return; - } - setAllServers(allServersWithScreenshots); // Don't update servers to include or exclude here to avoid // updating using an outdated input search term. Remember this @@ -202,13 +192,6 @@ const Dashboard: FC = () => { }, ); - useEffect( - () => () => { - componentMountedRef.current = false; - }, - [], - ); - return (