fix(codebase audit): preserve cleanup without regressions

Fix codebase audit regressions while preserving UI/UX behavior and adding review-driven hardening.
This commit is contained in:
Tommaso Casaburi
2026-04-24 15:48:07 +07:00
committed by GitHub
parent 5df994b2c7
commit 5dc5408a15
70 changed files with 1478 additions and 518 deletions
+22 -31
View File
@@ -1,4 +1,5 @@
import { lazy, Suspense, useEffect } from 'react';
import { useShallow } from 'zustand/react/shallow';
import { Navigate, Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { useAccount, useCommunity } from '@bitsocial/bitsocial-react-hooks';
import { initSnow, removeSnow } from './lib/snow';
@@ -31,9 +32,7 @@ import {
} from './lib/utils/route-utils';
import styles from './app.module.css';
import { DesktopBoardButtons, MobileAllFeedFilter, MobileBoardButtons } from './components/board-buttons';
import Board from './views/board';
import Blotter from './views/blotter';
import Catalog from './views/catalog';
import FAQ from './views/faq';
import Home from './views/home';
import Archive from './views/archive/archive';
@@ -180,7 +179,27 @@ const BoardLayout = () => {
const GlobalLayout = () => {
useTheme();
const { activeCid, parentNumber, threadNumber, threadCid, communityAddress: activeCommunityAddress, closeModal, showReplyModal, scrollY } = useReplyModalStore();
const {
activeCid,
parentNumber,
threadNumber,
threadCid,
communityAddress: activeCommunityAddress,
closeModal,
showReplyModal,
scrollY,
} = useReplyModalStore(
useShallow((state) => ({
activeCid: state.activeCid,
parentNumber: state.parentNumber,
threadNumber: state.threadNumber,
threadCid: state.threadCid,
communityAddress: state.communityAddress,
closeModal: state.closeModal,
showReplyModal: state.showReplyModal,
scrollY: state.scrollY,
})),
);
const location = useLocation();
const isInSettingsView = location.pathname.endsWith('/settings');
@@ -215,34 +234,6 @@ const GlobalLayout = () => {
);
};
/** Wraps Board with viewType/boardIdentifier derived from current route. Used when infinite scroll is OFF. */
const BoardFeedRoute = () => {
const location = useLocation();
const params = useParams();
const viewType: 'all' | 'subs' | 'mod' | 'board' = isAllView(location.pathname)
? 'all'
: isSubscriptionsView(location.pathname, params)
? 'subs'
: isModView(location.pathname)
? 'mod'
: 'board';
return <Board viewType={viewType} boardIdentifier={params.boardIdentifier} />;
};
/** Wraps Catalog with viewType/boardIdentifier derived from current route. Used when infinite scroll is OFF. */
const CatalogFeedRoute = () => {
const location = useLocation();
const params = useParams();
const viewType: 'all' | 'subs' | 'mod' | 'board' = isAllView(location.pathname)
? 'all'
: isSubscriptionsView(location.pathname, params)
? 'subs'
: isModView(location.pathname)
? 'mod'
: 'board';
return <Catalog viewType={viewType} boardIdentifier={params.boardIdentifier} />;
};
const ModQueueRoute = () => {
const { boardIdentifier } = useParams();
const account = useAccount();