revert %23 hash redirect

This commit is contained in:
Tom (plebeius.eth)
2025-02-20 21:44:10 +01:00
parent 57fc2bbfc2
commit d95d3342de
+1 -12
View File
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import { Outlet, Route, Routes, useLocation, useNavigate, useParams } from 'react-router-dom';
import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { useAccountComment, useAccountComments } from '@plebbit/plebbit-react-hooks';
import { initSnow, removeSnow } from './lib/snow';
import { isAllView, isSubscriptionsView } from './lib/utils/view-utils';
@@ -120,17 +120,6 @@ const GlobalLayout = () => {
};
const App = () => {
// react router doesn't handle the %23 hash correctly, so we need to replace it with #
const navigate = useNavigate();
const location = useLocation();
useEffect(() => {
const currentPath = location.pathname + location.hash;
if (currentPath.includes('%23')) {
const correctedPath = currentPath.replace('%23', '#');
navigate(correctedPath, { replace: true });
}
}, [location, navigate]);
return (
<div className={styles.app}>
<Routes>