From e48406d8542608fb217de7c0685a84b5d17650dd Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Tue, 23 Apr 2024 21:37:03 +0200 Subject: [PATCH] rerender postform if subplebbitAddress changes --- src/app.tsx | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/app.tsx b/src/app.tsx index 85072860..21ba4e42 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,5 +1,5 @@ import { useEffect } from 'react'; -import { Outlet, Route, Routes, useLocation } from 'react-router-dom'; +import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom'; import { isHomeView } from './lib/utils/view-utils'; import useTheme from './hooks/use-theme'; import styles from './app.module.css'; @@ -15,6 +15,20 @@ import { MobileBoardButtons } from './components/board-buttons'; import SubplebbitStats from './components/subplebbit-stats'; import PostForm from './components/post-form'; +const BoardLayout = () => { + const { subplebbitAddress } = useParams(); + return ( + <> + + + + + + + + + ); +}; const App = () => { const location = useLocation(); const isInHomeView = isHomeView(location.pathname); @@ -33,23 +47,11 @@ const App = () => { // // ); - const boardLayout = ( - <> - - - - - - - - - ); - return (
} /> - + }> } /> } /> } />