mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
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:
@@ -233,6 +233,7 @@ vi.mock('../../../hooks/use-state-string', () => ({
|
||||
|
||||
vi.mock('../../../hooks/use-window-width', () => ({
|
||||
default: () => testState.windowWidth,
|
||||
useIsMobileBreakpoint: () => testState.windowWidth < 640,
|
||||
}));
|
||||
|
||||
vi.mock('../../../stores/use-catalog-style-store', () => ({
|
||||
@@ -250,9 +251,10 @@ vi.mock('../../../stores/use-feed-reset-store', () => ({
|
||||
}));
|
||||
|
||||
vi.mock('../../../stores/use-sorting-store', () => ({
|
||||
default: () => ({
|
||||
sortType: testState.sortType,
|
||||
}),
|
||||
default: (selector?: (state: { sortType: typeof testState.sortType }) => unknown) => {
|
||||
const state = { sortType: testState.sortType };
|
||||
return selector ? selector(state) : state;
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('../../../stores/use-catalog-filters-store', () => ({
|
||||
|
||||
@@ -272,7 +272,8 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
||||
return resolvedAddressFromUrl;
|
||||
}, [boardIdentifierProp, directories, resolvedAddressFromUrl]);
|
||||
|
||||
const { filterItems, searchText } = useCatalogFiltersStore();
|
||||
const filterItems = useCatalogFiltersStore((state) => state.filterItems);
|
||||
const searchText = useCatalogFiltersStore((state) => state.searchText);
|
||||
|
||||
const account = useAccount();
|
||||
const subscriptions = account?.subscriptions;
|
||||
@@ -306,7 +307,8 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
||||
const communities = useCommunityIdentifiers(communityAddresses);
|
||||
const communityIdentifier = useCommunityIdentifier(communityAddress);
|
||||
|
||||
const { imageSize, showOPComment } = useCatalogStyleStore();
|
||||
const imageSize = useCatalogStyleStore((state) => state.imageSize);
|
||||
const showOPComment = useCatalogStyleStore((state) => state.showOPComment);
|
||||
const columnWidth = imageSize === 'Large' ? 270 : 180;
|
||||
const windowWidth = useWindowWidth();
|
||||
const isMobile = useIsMobile();
|
||||
@@ -325,7 +327,7 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
||||
}
|
||||
}, [isInAllView, isInSubscriptionsView, isInModView, location.pathname, location.search, navigate]);
|
||||
|
||||
const { sortType } = useSortingStore();
|
||||
const sortType = useSortingStore((state) => state.sortType);
|
||||
const feedSortType = sortType === 'new' ? 'new' : 'active';
|
||||
const catalogVirtualizationMode = useMemo(() => resolveCatalogVirtualizationMode(location.search, 'item-size'), [location.search]);
|
||||
const themeKey = typeof document !== 'undefined' ? document.body.className : '';
|
||||
@@ -632,7 +634,6 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
||||
effectiveInfiniteScroll,
|
||||
],
|
||||
);
|
||||
|
||||
const isFeedLoaded = feed.length > 0 || state === 'failed';
|
||||
|
||||
// Process the feed to move "top" posts to the top (applied after display sort)
|
||||
|
||||
Reference in New Issue
Block a user