@@ -17,7 +17,7 @@ import {
1717 getSessionRunningState ,
1818 getLastTurnGroupId ,
1919} from "./message-list-shared" ;
20- import { createDebugLogger , IS_DEBUG } from "@/lib/debug/log" ;
20+ import { createDebugLogger , isDebug } from "@/lib/debug/log" ;
2121
2222const FIRST_INDEX_BASE = 100_000 ;
2323
@@ -62,7 +62,7 @@ function useStableFirstItemIndex(items: RenderItem[]) {
6262
6363 const [ state , setState ] = useState < IndexState > ( ( ) => {
6464 const firstItemIndex = FIRST_INDEX_BASE - keys . length + 1 ;
65- if ( IS_DEBUG ) {
65+ if ( isDebug ( ) ) {
6666 debugFirstIndex ( "init" , {
6767 keyCount : keys . length ,
6868 firstItemIndex,
@@ -75,7 +75,7 @@ function useStableFirstItemIndex(items: RenderItem[]) {
7575
7676 if ( keys !== state . keys ) {
7777 const nextIndex = computeFirstItemIndex ( state . keys , state . firstItemIndex , keys ) ;
78- if ( IS_DEBUG ) {
78+ if ( isDebug ( ) ) {
7979 debugFirstIndex ( "transition" , {
8080 prevKeyCount : state . keys . length ,
8181 nextKeyCount : keys . length ,
@@ -204,7 +204,7 @@ function VirtuosoBody(props: VirtuosoBodyProps) {
204204 // anchored on for that lifecycle.
205205 const mountSnapshotRef = useRef < { itemCount : number ; firstItemIndex : number } | null > ( null ) ;
206206 useEffect ( ( ) => {
207- if ( ! IS_DEBUG ) return ;
207+ if ( ! isDebug ( ) ) return ;
208208 if ( mountSnapshotRef . current ) return ;
209209 mountSnapshotRef . current = { itemCount, firstItemIndex } ;
210210 debugVirtuoso ( "mount" , {
@@ -308,7 +308,7 @@ function useVirtuosoDebugSnapshot({
308308} : UseVirtuosoDebugSnapshotArgs ) {
309309 const prevSnapshotRef = useRef < VirtuosoSnapshot | null > ( null ) ;
310310 useEffect ( ( ) => {
311- if ( ! IS_DEBUG ) return ;
311+ if ( ! isDebug ( ) ) return ;
312312 const snapshot : VirtuosoSnapshot = {
313313 branch : isInitialLoading || items . length === 0 ? "fallback" : "virtuoso" ,
314314 itemCount : items . length ,
@@ -346,14 +346,14 @@ function useVisibleScrollParent() {
346346 const setScrollRef = useCallback ( ( node : HTMLDivElement | null ) => {
347347 nodeRef . current = node ;
348348 if ( node && node . offsetHeight > 0 ) {
349- if ( IS_DEBUG ) {
349+ if ( isDebug ( ) ) {
350350 debugScrollParent ( "ref-callback-ready" , {
351351 offsetHeight : node . offsetHeight ,
352352 path : "synchronous" ,
353353 } ) ;
354354 }
355355 setScrollParent ( node ) ;
356- } else if ( IS_DEBUG ) {
356+ } else if ( isDebug ( ) ) {
357357 debugScrollParent ( "ref-callback-defer" , {
358358 hasNode : Boolean ( node ) ,
359359 offsetHeight : node ?. offsetHeight ?? null ,
@@ -364,15 +364,15 @@ function useVisibleScrollParent() {
364364 useEffect ( ( ) => {
365365 const node = nodeRef . current ;
366366 if ( ! node || scrollParent ) return ;
367- if ( IS_DEBUG ) {
367+ if ( isDebug ( ) ) {
368368 debugScrollParent ( "ro-attach" , {
369369 initialHeight : node . offsetHeight ,
370370 } ) ;
371371 }
372372 const ro = new ResizeObserver ( ( entries ) => {
373373 for ( const entry of entries ) {
374374 if ( entry . contentRect . height > 0 ) {
375- if ( IS_DEBUG ) {
375+ if ( isDebug ( ) ) {
376376 debugScrollParent ( "ro-ready" , {
377377 height : entry . contentRect . height ,
378378 } ) ;
0 commit comments