mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(app): preserve post form drafts in settings
This commit is contained in:
+3
-1
@@ -64,6 +64,8 @@ const SettingsModal = lazy(() => import('./components/settings-modal'));
|
||||
preloadThemeAssets();
|
||||
preloadReplyModal();
|
||||
|
||||
const getPostFormRouteKeyPath = (pathname: string) => pathname.replace(/\/settings$/, '').replace(/\/$/, '');
|
||||
|
||||
const BoardLayout = () => {
|
||||
const params = useParams();
|
||||
const { accountCommentIndex, boardIdentifier, pageNumber } = params;
|
||||
@@ -101,7 +103,7 @@ const BoardLayout = () => {
|
||||
}, [pathname, closeCreateBoardModal]);
|
||||
|
||||
// force rerender of post form when navigating between pages, except when opening settings modal in current view
|
||||
const key = pathname.endsWith('/settings') ? `${communityAddress}-${pathname.replace(/\/settings$/, '')}` : `${communityAddress}-${pathname}`;
|
||||
const key = `${communityAddress}-${getPostFormRouteKeyPath(pathname)}`;
|
||||
|
||||
if (pageNumber === '1') {
|
||||
return <Navigate to='/not-found' replace />;
|
||||
|
||||
Reference in New Issue
Block a user