chore(desktop): drop react-virtuoso + scroll debug instrumentation
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user