code optimisation

This commit is contained in:
2022-06-09 11:48:05 +02:00
parent 47e2a1f27c
commit 25dee4921b
9 changed files with 41 additions and 21 deletions

View File

@@ -30,6 +30,7 @@ export default function Home({ socket }: Props) {
const [url, setUrl] = useState('');
const [workingUrl, setWorkingUrl] = useState('');
const [showBackdrop, setShowBackdrop] = useState(false);
const [showToast, setShowToast] = useState(true);
/* -------------------- Effects -------------------- */
/* WebSocket connect event handler*/
@@ -330,10 +331,10 @@ export default function Home({ socket }: Props) {
}
</Grid>
<Snackbar
open={status.connected}
open={showToast === status.connected}
autoHideDuration={1500}
message="Connected"
onClose={() => dispatch(disconnected())}
onClose={() => setShowToast(false)}
/>
</Container>
);