hacky fix infinite loop
This commit is contained in:
parent
cf23f0a85e
commit
794d9d84ca
1 changed files with 9 additions and 4 deletions
13
src/App.tsx
13
src/App.tsx
|
@ -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('#/')) {
|
||||||
|
|
Loading…
Reference in a new issue