|
|
@ -1,7 +1,7 @@ |
|
|
|
import { Add as AddIcon } from '@mui/icons-material'; |
|
|
|
import { Add as AddIcon } from '@mui/icons-material'; |
|
|
|
import { Box, Divider, Grid } from '@mui/material'; |
|
|
|
import { Box, Divider, Grid } from '@mui/material'; |
|
|
|
import Head from 'next/head'; |
|
|
|
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 API_BASE_URL from '../lib/consts/API_BASE_URL'; |
|
|
|
import { DIVIDER } from '../lib/consts/DEFAULT_THEME'; |
|
|
|
import { DIVIDER } from '../lib/consts/DEFAULT_THEME'; |
|
|
@ -120,8 +120,6 @@ const filterServers = (allServers: ServerListItem[], searchTerm: string) => |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const Dashboard: FC = () => { |
|
|
|
const Dashboard: FC = () => { |
|
|
|
const componentMountedRef = useRef(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [allServers, setAllServers] = useState<ServerListItem[]>([]); |
|
|
|
const [allServers, setAllServers] = useState<ServerListItem[]>([]); |
|
|
|
const [excludeServers, setExcludeServers] = useState<ServerListItem[]>([]); |
|
|
|
const [excludeServers, setExcludeServers] = useState<ServerListItem[]>([]); |
|
|
|
const [includeServers, setIncludeServers] = useState<ServerListItem[]>([]); |
|
|
|
const [includeServers, setIncludeServers] = useState<ServerListItem[]>([]); |
|
|
@ -136,10 +134,6 @@ const Dashboard: FC = () => { |
|
|
|
) => { |
|
|
|
) => { |
|
|
|
const { exclude, include } = filterServers(...filterArgs); |
|
|
|
const { exclude, include } = filterServers(...filterArgs); |
|
|
|
|
|
|
|
|
|
|
|
if (!componentMountedRef.current) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setExcludeServers(exclude); |
|
|
|
setExcludeServers(exclude); |
|
|
|
setIncludeServers(include); |
|
|
|
setIncludeServers(include); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -175,10 +169,6 @@ const Dashboard: FC = () => { |
|
|
|
|
|
|
|
|
|
|
|
const allServersWithScreenshots = [...serverListItems]; |
|
|
|
const allServersWithScreenshots = [...serverListItems]; |
|
|
|
|
|
|
|
|
|
|
|
if (!componentMountedRef.current) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setAllServers(allServersWithScreenshots); |
|
|
|
setAllServers(allServersWithScreenshots); |
|
|
|
// Don't update servers to include or exclude here to avoid
|
|
|
|
// Don't update servers to include or exclude here to avoid
|
|
|
|
// updating using an outdated input search term. Remember this
|
|
|
|
// updating using an outdated input search term. Remember this
|
|
|
@ -202,13 +192,6 @@ const Dashboard: FC = () => { |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
useEffect( |
|
|
|
|
|
|
|
() => () => { |
|
|
|
|
|
|
|
componentMountedRef.current = false; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
[], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Box> |
|
|
|
<Box> |
|
|
|
<Head> |
|
|
|
<Head> |
|
|
|