File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/app/leverage/components Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { Button } from '@headlessui/react'
2
2
import { useAppKit } from '@reown/appkit/react'
3
3
import Script from 'next/script'
4
- import { useState } from 'react'
4
+ import { useEffect , useState } from 'react'
5
5
6
6
import { TradingViewChartContainer } from '@/app/leverage/components/trading-view-chart-container'
7
7
import { useWallet } from '@/lib/hooks/use-wallet'
@@ -10,6 +10,17 @@ export function TradingViewChart() {
10
10
const [ isScriptReady , setIsScriptReady ] = useState ( false )
11
11
const { isConnected } = useWallet ( )
12
12
const { open } = useAppKit ( )
13
+
14
+ useEffect ( ( ) => {
15
+ const scriptAlreadyLoaded = document . querySelector (
16
+ 'script[src="/tradingview-chart/datafeeds/udf/dist/bundle.js"]' ,
17
+ )
18
+
19
+ if ( scriptAlreadyLoaded ) {
20
+ setIsScriptReady ( true )
21
+ }
22
+ } , [ ] )
23
+
13
24
return (
14
25
< div className = 'xs:h-[422px] relative aspect-square w-full lg:aspect-auto' >
15
26
< Script
You can’t perform that action at this time.
0 commit comments