perf(board): reduce desktop reverse-scroll jank on /all

Apply the asymmetric viewport buffer that already fixed mobile to desktop
multiboard feeds, and trim per-post mount cost so remounts during scroll-up
are cheaper:

- Desktop multiboard buffer goes from {600,600} to {1200,2400} (top-heavy),
  matching the mobile pattern from 99c0bbfac so items stay mounted longer
  when scrolling back up
- Cache feed post height estimate by CID in pretext-height-estimates so
  remounts skip the Pretext text-measurement work
- Memoize CommentMedia and switch its expanded-media-store reads to atomic
  selectors so it stops rerendering on unrelated store changes
- Memoize useCommentMediaInfo return so its reference is stable for memo
  comparators downstream
- Stop useFetchGifFirstFrame from forcing an extra render on every post
  mount by bailing out of equivalent setState calls
- Extract PendingModerationActions out of PostInfo so the two
  usePublishCommentModeration calls only run on the post page when
  mod-approval is actually pending, not on every feed item
This commit is contained in:
Tommaso Casaburi
2026-04-18 13:31:02 +07:00
parent d07f5b3962
commit e161606147
8 changed files with 228 additions and 142 deletions
@@ -34,12 +34,15 @@ vi.mock('../../../lib/utils/url-utils', () => ({
getHostname: () => testState.hostname,
}));
vi.mock('../../../stores/use-expanded-media-store', () => ({
default: () => ({
vi.mock('../../../stores/use-expanded-media-store', () => {
const getState = () => ({
fitExpandedImagesToScreen: testState.fitExpandedImagesToScreen,
unmuteExpandedVideoSound: testState.unmuteExpandedVideoSound,
}),
}));
});
return {
default: (selector?: (s: ReturnType<typeof getState>) => unknown) => (selector ? selector(getState()) : getState()),
};
});
vi.mock('../../../hooks/use-fetch-gif-first-frame', () => ({
default: () => ({