chore(desktop): drop react-virtuoso + scroll debug instrumentation

This commit is contained in:
byGalax
2026-06-02 20:44:56 +02:00
parent 271d6fff5c
commit 31b394a6e0
3 changed files with 0 additions and 44 deletions
-1
View File
@@ -36,7 +36,6 @@
"react-easy-crop": "^5.5.7",
"react-i18next": "^15.1.1",
"react-router-dom": "^6.28.0",
"react-virtuoso": "^4.18.7",
"zustand": "^5.0.1"
},
"devDependencies": {
@@ -110,21 +110,6 @@ const EMPTY_REACTIONS: AggregatedReaction[] = [];
// reading position even if some rows above re-render at different heights.
const scrollPositions = new Map<string, { topmostIndex: number; stickToBottom: boolean }>();
// ── TEMP scroll-jank instrumentation ──────────────────────────────────────
// Flip SCROLL_DEBUG to false or delete this block once the chat-switch flicker
// is root-caused. Logs go to the devtools console AND window.__scrolllog (copy
// the whole run with: copy(window.__scrolllog.join('\n')) ).
const SCROLL_DEBUG = true;
const dbgNow = (): number => Math.round(performance.now());
const dbgLog = (line: string): void => {
if (!SCROLL_DEBUG) return;
const w = window as unknown as { __scrolllog?: string[] };
(w.__scrolllog ??= []).push(line);
// eslint-disable-next-line no-console
console.log(line);
};
// ──────────────────────────────────────────────────────────────────────────
/** Pending composer attachment: the raw File plus the per-attachment
* view-once flag the user can toggle from the thumb hover button (P7.T4).
* Lives only in composer state — the flag is forwarded into
@@ -506,18 +491,6 @@ export function ConversationPage() {
return { type: 'bottom' };
}, []);
// SCROLL_DEBUG: log every render with the height-affecting inputs so the
// post-mount cascade (reactions/pins/receipts/divider/refresh) is visible.
useEffect(() => {
dbgLog(
`[scroll] render t=${dbgNow()} id=${(id ?? '').slice(0, 6)} loading=${loading}` +
` msgs=${messages.length} rows=${virtuosoRows.length} ready=${listReady}` +
` reactions=${reactionsByMessage.size} pins=${pins.length}` +
` firstUnread=${firstUnreadId ? 'set' : '-'}` +
` displayCount=${displayCount} anchor=${JSON.stringify(initialAnchor)}`,
);
});
const jumpToMessage = useCallback(
(targetId: string) => {
const msgIdx = messages.findIndex((m) => m.id === targetId);
@@ -720,7 +693,6 @@ export function ConversationPage() {
// away counter when the user actually reaches the bottom.
const handleAtBottomStateChange = useCallback(
(atBottom: boolean) => {
dbgLog(`[scroll] atBottom=${atBottom} t=${dbgNow()}`);
setStickToBottom(atBottom);
if (atBottom) setNewMessagesWhileAway(0);
if (id) {
@@ -739,7 +711,6 @@ export function ConversationPage() {
// we only care about the start of the range here.
const handleRangeChanged = useCallback(
(range: { startIndex: number; endIndex: number }) => {
dbgLog(`[scroll] range t=${dbgNow()} start=${range.startIndex} end=${range.endIndex}`);
topmostIndexRef.current = range.startIndex;
if (id) {
const prev = scrollPositions.get(id);
-14
View File
@@ -101,9 +101,6 @@ importers:
react-router-dom:
specifier: ^6.28.0
version: 6.30.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react-virtuoso:
specifier: ^4.18.7
version: 4.18.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
zustand:
specifier: ^5.0.1
version: 5.0.12(@types/react@18.3.28)(react@18.3.1)(use-sync-external-store@1.6.0(react@18.3.1))
@@ -5491,12 +5488,6 @@ packages:
peerDependencies:
react: ^18.3.1
react-virtuoso@4.18.7:
resolution: {integrity: sha512-xNF5zDGEEIMB7cKwcen/pLig0YDf6OnfFrVgKFa7sHPf9fRem0CaLshyObbBcP88jzn0enavL39EgplgdyT21g==}
peerDependencies:
react: '>=16 || >=17 || >= 18 || >= 19'
react-dom: '>=16 || >=17 || >= 18 || >=19'
react@18.3.1:
resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
engines: {node: '>=0.10.0'}
@@ -12992,11 +12983,6 @@ snapshots:
react-shallow-renderer: 16.15.0(react@18.3.1)
scheduler: 0.23.2
react-virtuoso@4.18.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
react@18.3.1:
dependencies:
loose-envify: 1.4.0