chore(desktop): drop react-virtuoso + scroll debug instrumentation
This commit is contained in:
@@ -36,7 +36,6 @@
|
|||||||
"react-easy-crop": "^5.5.7",
|
"react-easy-crop": "^5.5.7",
|
||||||
"react-i18next": "^15.1.1",
|
"react-i18next": "^15.1.1",
|
||||||
"react-router-dom": "^6.28.0",
|
"react-router-dom": "^6.28.0",
|
||||||
"react-virtuoso": "^4.18.7",
|
|
||||||
"zustand": "^5.0.1"
|
"zustand": "^5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -110,21 +110,6 @@ const EMPTY_REACTIONS: AggregatedReaction[] = [];
|
|||||||
// reading position even if some rows above re-render at different heights.
|
// reading position even if some rows above re-render at different heights.
|
||||||
const scrollPositions = new Map<string, { topmostIndex: number; stickToBottom: boolean }>();
|
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
|
/** Pending composer attachment: the raw File plus the per-attachment
|
||||||
* view-once flag the user can toggle from the thumb hover button (P7.T4).
|
* view-once flag the user can toggle from the thumb hover button (P7.T4).
|
||||||
* Lives only in composer state — the flag is forwarded into
|
* Lives only in composer state — the flag is forwarded into
|
||||||
@@ -506,18 +491,6 @@ export function ConversationPage() {
|
|||||||
return { type: 'bottom' };
|
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(
|
const jumpToMessage = useCallback(
|
||||||
(targetId: string) => {
|
(targetId: string) => {
|
||||||
const msgIdx = messages.findIndex((m) => m.id === targetId);
|
const msgIdx = messages.findIndex((m) => m.id === targetId);
|
||||||
@@ -720,7 +693,6 @@ export function ConversationPage() {
|
|||||||
// away counter when the user actually reaches the bottom.
|
// away counter when the user actually reaches the bottom.
|
||||||
const handleAtBottomStateChange = useCallback(
|
const handleAtBottomStateChange = useCallback(
|
||||||
(atBottom: boolean) => {
|
(atBottom: boolean) => {
|
||||||
dbgLog(`[scroll] atBottom=${atBottom} t=${dbgNow()}`);
|
|
||||||
setStickToBottom(atBottom);
|
setStickToBottom(atBottom);
|
||||||
if (atBottom) setNewMessagesWhileAway(0);
|
if (atBottom) setNewMessagesWhileAway(0);
|
||||||
if (id) {
|
if (id) {
|
||||||
@@ -739,7 +711,6 @@ export function ConversationPage() {
|
|||||||
// we only care about the start of the range here.
|
// we only care about the start of the range here.
|
||||||
const handleRangeChanged = useCallback(
|
const handleRangeChanged = useCallback(
|
||||||
(range: { startIndex: number; endIndex: number }) => {
|
(range: { startIndex: number; endIndex: number }) => {
|
||||||
dbgLog(`[scroll] range t=${dbgNow()} start=${range.startIndex} end=${range.endIndex}`);
|
|
||||||
topmostIndexRef.current = range.startIndex;
|
topmostIndexRef.current = range.startIndex;
|
||||||
if (id) {
|
if (id) {
|
||||||
const prev = scrollPositions.get(id);
|
const prev = scrollPositions.get(id);
|
||||||
|
|||||||
Generated
-14
@@ -101,9 +101,6 @@ importers:
|
|||||||
react-router-dom:
|
react-router-dom:
|
||||||
specifier: ^6.28.0
|
specifier: ^6.28.0
|
||||||
version: 6.30.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
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:
|
zustand:
|
||||||
specifier: ^5.0.1
|
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))
|
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:
|
peerDependencies:
|
||||||
react: ^18.3.1
|
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:
|
react@18.3.1:
|
||||||
resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
|
resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
@@ -12992,11 +12983,6 @@ snapshots:
|
|||||||
react-shallow-renderer: 16.15.0(react@18.3.1)
|
react-shallow-renderer: 16.15.0(react@18.3.1)
|
||||||
scheduler: 0.23.2
|
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:
|
react@18.3.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
loose-envify: 1.4.0
|
loose-envify: 1.4.0
|
||||||
|
|||||||
Reference in New Issue
Block a user