@@ -51,11 +51,18 @@ export default function LiquidationSidebar({ volumeThresholds = {}, maxEvents =
5151
5252 // Load historical liquidations on mount
5353 useEffect ( ( ) => {
54+ console . log ( `[LiquidationSidebar:${ instanceId . current } ] Historical liquidation useEffect triggered` ) ;
55+
5456 const loadHistoricalLiquidations = async ( ) => {
5557 try {
58+ console . log ( `[LiquidationSidebar:${ instanceId . current } ] Fetching historical liquidations from API...` ) ;
5659 const response = await fetch ( `/api/liquidations?limit=${ maxEventsRef . current } ` ) ;
60+ console . log ( `[LiquidationSidebar:${ instanceId . current } ] API response status:` , response . status ) ;
61+
5762 if ( response . ok ) {
5863 const result = await response . json ( ) ;
64+ console . log ( `[LiquidationSidebar:${ instanceId . current } ] API response:` , result ) ;
65+
5966 if ( result . success && result . data ) {
6067 const historicalEvents = result . data . map ( ( liq : any ) => {
6168 const volume = liq . volume_usdt || ( liq . quantity * liq . price ) ;
@@ -74,12 +81,16 @@ export default function LiquidationSidebar({ volumeThresholds = {}, maxEvents =
7481 isHighVolume : volume >= threshold ,
7582 } ;
7683 } ) ;
77- console . log ( `Loaded ${ historicalEvents . length } historical liquidations` ) ;
84+ console . log ( `[LiquidationSidebar: ${ instanceId . current } ] Loaded ${ historicalEvents . length } historical liquidations` ) ;
7885 setEvents ( historicalEvents ) ;
86+ } else {
87+ console . log ( `[LiquidationSidebar:${ instanceId . current } ] No data in API response or unsuccessful` ) ;
7988 }
89+ } else {
90+ console . error ( `[LiquidationSidebar:${ instanceId . current } ] API request failed with status:` , response . status ) ;
8091 }
8192 } catch ( error ) {
82- console . error ( ' Failed to load historical liquidations:' , error ) ;
93+ console . error ( `[LiquidationSidebar: ${ instanceId . current } ] Failed to load historical liquidations:` , error ) ;
8394 } finally {
8495 setIsLoading ( false ) ;
8596 }
0 commit comments