fix(app): preserve post form drafts in settings

This commit is contained in:
Tommaso Casaburi
2026-05-18 16:07:40 +07:00
parent c3d53202a3
commit f39ad096b7
2 changed files with 91 additions and 5 deletions
+3 -1
View File
@@ -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 />;