mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf(react-doctor): fix compiler-blocking patterns, raise score 72→81
Replace sync setState-in-effect with keyed remount and render-derived patterns in app, error-display, topbar-edit-modal, catalog-filters; use useCurrentTime() instead of Date.now() in hot paths; fix conditional hooks, passive scroll listeners, lodash path imports.
This commit is contained in:
@@ -12,7 +12,7 @@ import useDirectoryModalStore from '../../stores/use-directory-modal-store';
|
||||
import DisclaimerModal from '../../components/disclaimer-modal';
|
||||
import DirectoryModal from '../../components/directory-modal';
|
||||
import { getBoardPath } from '../../lib/utils/route-utils';
|
||||
import { lowerCase } from 'lodash';
|
||||
import lowerCase from 'lodash/lowerCase';
|
||||
|
||||
// https://github.com/bitsocialhq/lists/blob/master/5chan-directories.json
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ const PopularThreadsBox = ({ directories, subplebbits }: { directories: Director
|
||||
const { t } = useTranslation();
|
||||
const { showWorksafeContentOnly, showNsfwContentOnly } = usePopularThreadsOptionsStore();
|
||||
|
||||
const getFilteredSubplebbits = () => {
|
||||
const filteredSubplebbits = useMemo(() => {
|
||||
if (showWorksafeContentOnly) {
|
||||
return subplebbits.filter((sub: Subplebbit) => {
|
||||
const directoriesEntry = directories.find((ms) => ms?.address === sub?.address);
|
||||
@@ -84,9 +84,7 @@ const PopularThreadsBox = ({ directories, subplebbits }: { directories: Director
|
||||
});
|
||||
}
|
||||
return subplebbits;
|
||||
};
|
||||
|
||||
const filteredSubplebbits = useMemo(getFilteredSubplebbits, [subplebbits, showWorksafeContentOnly, showNsfwContentOnly, directories]);
|
||||
}, [subplebbits, showWorksafeContentOnly, showNsfwContentOnly, directories]);
|
||||
const { popularPosts } = usePopularPosts(filteredSubplebbits);
|
||||
const isLoading = popularPosts.length === 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user