hacky fix infinite loop

This commit is contained in:
Jorik Schellekens 2020-09-16 14:57:48 +01:00
parent cf23f0a85e
commit 794d9d84ca

View File

@ -36,13 +36,18 @@ const App: React.FC = () => {
</> </>
); );
// Some hacky uri decoding
location.href = decodeURIComponent(location.href);
const [hash, setHash] = useState(location.hash); const [hash, setHash] = useState(location.hash);
console.log(hash); console.log(hash);
useEffect(() => (window.onhashchange = () => setHash(location.hash)), []); useEffect(() => {
// Some hacky uri decoding
if (location.href.split('/').length > 4) {
location.href = decodeURIComponent(location.href);
}
window.onhashchange = () => setHash(location.hash);
console.log('why');
}, []);
if (hash) { if (hash) {
if (hash.startsWith('#/')) { if (hash.startsWith('#/')) {