JorrinKievit / react-ts-tradingview-widgets

This is a React component library for TradingView Widgets
https://tradingview-widgets.jorrinkievit.xyz/
MIT License
154 stars 48 forks source link

Nextjs AdvancedRealTimeChart error with redirects #33

Open Doberman2029 opened 1 year ago

Doberman2029 commented 1 year ago

Bug Description The graph opens on top of the entire application, and breaks the entire page in nextjs projects

Steps to Reproduce

  1. Create next project using next v12.1.5 or next v13.2.4
  2. Create 2 page with redirect between them
  3. Integrate AdvancedRealTimeChart widget v1.0.12 or v1.0.14 (didn't try other versions) on first page
  4. Throttle your network speed to low
  5. Be on page 2 (which is without a chart), quickly switch to the page with a chart and go back instantly by clicking on the redirect button. An error occurred

Additional Context Video with error error.webm

JorrinKievit commented 1 year ago

Can you share code/repo? Can't reproduce

Doberman2029 commented 1 year ago

Yeah, sure https://github.com/Doberman2029/react-ts-tradingview-widgets-error To reproduce it is important to slow down the speed of the Internet. And you need to switch from the page with the chart instantly, while, as I understand it, the data for the chart is being loaded image

Doberman2029 commented 1 year ago

@JorrinKievit Hey Jorrin. Do you have some news about problem?

JorrinKievit commented 1 year ago

Nope, haven't had the time to look into it.

Doberman2029 commented 1 year ago

@JorrinKievit Hello, Jorrin. Haven't been able to see the issue yet?

JorrinKievit commented 1 year ago

I have, but to be honest i have no idea on how to fix it yet. It's quite time consuming too to debug external behaviour of iframes. I dont wanna come across as mean, but if you have the time please feel free to clone and see if you can figure it out ;D

Doberman2029 commented 1 year ago

I tried to fix. But also no result :)

JorrinKievit commented 1 year ago

Ye it for sure is an interesting one, ill take a look again this weekend but don't keep your hopes up haha

JorrinKievit commented 1 year ago

Hoped to fix it with the fix i just did for the other issue, but no luck :(. To be honest i have no idea what is happening haha

Doberman2029 commented 1 year ago

I think the problem is that if the widget gets data after leaving the page with the widget it tries to rerender itself. But since he no longer sees the container with the given id it's drawn on the entire page and breaks it