this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix http route not working

+27 -10
+27 -10
src/pages/HttpRoute.jsx
··· 1 + import { useLayoutEffect } from 'preact/hooks'; 1 2 import { useLocation } from 'react-router-dom'; 2 3 3 4 import Link from '../components/link'; ··· 7 8 const location = useLocation(); 8 9 const url = location.pathname.replace(/^\//, ''); 9 10 const statusURL = getInstanceStatusURL(url); 10 - if (statusURL) { 11 - window.location.hash = statusURL + '?view=full'; 12 - return null; 13 - } 11 + 12 + useLayoutEffect(() => { 13 + if (statusURL) { 14 + setTimeout(() => { 15 + window.location.hash = statusURL + '?view=full'; 16 + }, 300); 17 + } 18 + }, [statusURL]); 19 + 14 20 return ( 15 21 <div class="ui-state" tabIndex="-1"> 16 - <h2>Unable to process URL</h2> 17 - <p> 18 - <a href={url} target="_blank"> 19 - {url} 20 - </a> 21 - </p> 22 + {statusURL ? ( 23 + <> 24 + <h2>Redirecting…</h2> 25 + <p> 26 + <a href={`#${statusURL}?view=full`}>{statusURL}</a> 27 + </p> 28 + </> 29 + ) : ( 30 + <> 31 + <h2>Unable to process URL</h2> 32 + <p> 33 + <a href={url} target="_blank"> 34 + {url} 35 + </a> 36 + </p> 37 + </> 38 + )} 22 39 <hr /> 23 40 <p> 24 41 <Link to="/">Go home</Link>