perf(bundle): replace plebbit-js imports with local utility, split chunks, fix CLS and rerenders

Eliminate direct @plebbit/plebbit-js (8.7MB) imports from all UI components by replacing
Plebbit.getShortAddress() with a local get-short-address utility. Add Vite manual chunks for
plebbit-js, plebbit-react-hooks, and react-spring/use-gesture. Fix catalog CLS by matching
skeleton to wrapper dimensions. Lazy-load ChallengeModal and ReplyModal. Add failed-URL cache
to useFetchGifFirstFrame, optimize useHide selector, and memoize useFeed options in mod-queue.
This commit is contained in:
plebeius
2026-02-26 16:42:36 +08:00
parent cd71602730
commit 4bdee0362d
16 changed files with 92 additions and 59 deletions
+17 -13
View File
@@ -27,9 +27,7 @@ import PendingPost from './views/pending-post';
import Post from './views/post';
import Rules from './views/rules';
import BoardHeader from './components/board-header';
import ChallengeModal from './components/challenge-modal';
import FeedCacheContainer from './components/feed-cache-container';
import ReplyModal from './components/reply-modal';
import PostForm from './components/post-form';
import BoardBlotter from './components/board-blotter';
import BoardsBar from './components/boardsbar';
@@ -37,8 +35,10 @@ import BoardsBar from './components/boardsbar';
const AccountDataEditor = lazy(() => import('./views/account-data-editor'));
const BoardsBarEditModal = lazy(() => import('./components/boardsbar-edit-modal'));
const CreateBoardModal = lazy(() => import('./components/create-board-modal'));
const ChallengeModal = lazy(() => import('./components/challenge-modal'));
const DirectoryModal = lazy(() => import('./components/directory-modal'));
const DisclaimerModal = lazy(() => import('./components/disclaimer-modal'));
const ReplyModal = lazy(() => import('./components/reply-modal'));
const SettingsModal = lazy(() => import('./components/settings-modal'));
// Preload all theme assets (buttons, backgrounds) immediately on app load
@@ -134,18 +134,22 @@ const GlobalLayout = () => {
return (
<>
<ChallengeModal />
<Suspense fallback={null}>
<ChallengeModal />
</Suspense>
{activeCid && threadCid && subplebbitAddress && (
<ReplyModal
closeModal={closeModal}
parentCid={activeCid}
parentNumber={parentNumber}
threadNumber={threadNumber}
postCid={threadCid}
scrollY={scrollY}
showReplyModal={showReplyModal}
subplebbitAddress={subplebbitAddress}
/>
<Suspense fallback={null}>
<ReplyModal
closeModal={closeModal}
parentCid={activeCid}
parentNumber={parentNumber}
threadNumber={threadNumber}
postCid={threadCid}
scrollY={scrollY}
showReplyModal={showReplyModal}
subplebbitAddress={subplebbitAddress}
/>
</Suspense>
)}
{isInSettingsView && (
<Suspense fallback={null}>