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
+8
View File
@@ -0,0 +1,8 @@
const getShortAddress = (address: string): string => {
if (!address) return '';
if (address.includes('.')) return address;
if (address.length < 20) return '';
return address.slice(8, 20);
};
export default getShortAddress;
+6 -7
View File
@@ -1,10 +1,9 @@
if (import.meta.env.DEV) {
const { scan, getReport } = await import('react-scan');
scan({
enabled: true,
showToolbar: !(window as any).__PROFILING__,
playSound: !(window as any).__PROFILING__,
report: true,
import('react-scan').then(({ scan, getReport }) => {
scan({
enabled: true,
showToolbar: !(window as any).__PROFILING__,
});
(window as any).__getReactScanReport = getReport;
});
(window as any).__getReactScanReport = getReport;
}