File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
apps/insights/src/components/PriceFeed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 11"use client" ;
22
33import { useLogger } from "@pythnetwork/component-library/useLogger" ;
4- import { useResizeObserver } from "@react-hookz/web" ;
4+ import { useResizeObserver , useMountEffect } from "@react-hookz/web" ;
55import type { IChartApi , ISeriesApi , UTCTimestamp } from "lightweight-charts" ;
66import { LineSeries , LineStyle , createChart } from "lightweight-charts" ;
77import { useTheme } from "next-themes" ;
@@ -101,10 +101,10 @@ const useChartElem = (symbol: string, feedId: string) => {
101101 }
102102 } , [ logger , symbol ] ) ;
103103
104- useEffect ( ( ) => {
104+ useMountEffect ( ( ) => {
105105 const chartElem = chartContainerRef . current ;
106106 if ( chartElem === null ) {
107- return ;
107+ throw new Error ( "Chart element was null on mount" ) ;
108108 } else {
109109 const chart = createChart ( chartElem , {
110110 layout : {
@@ -146,7 +146,7 @@ const useChartElem = (symbol: string, feedId: string) => {
146146 chart . remove ( ) ;
147147 } ;
148148 }
149- } , [ backfillData , priceFormatter ] ) ;
149+ } ) ;
150150
151151 useEffect ( ( ) => {
152152 if ( current && chartRef . current ) {
You can’t perform that action at this time.
0 commit comments