Greetings, Having and Angular related react issue ...
# gooddata-ui
v
Greetings, Having and Angular related react issue using GoodData.UI. I have had success in rendering the react components using the Angular wrapper. The issue comes when I want to have more than one react component rendered in the DOM. The browser goes into an infinite loop trying to update the components and none of them fully render:
Copy code
react-dom.development.js:88 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
    in LoadingHOCWrapped (created by Context.Consumer)
    in injectIntl(LoadingHOCWrapped) (created by LoadingHOC)
    in IntlProvider (created by IntlWrapper)
    in IntlWrapper (created by LoadingHOC)
    in LoadingHOC
In this case, if I place two versions of the same component on a page, it starts that behavior. This is really perplexing and would be a blocker to implementation. Thanks in advance for your assistance and please let me know if there is more information that I can provide.
This behavior seems to go away when upgrading to react 18
getting some new weird console errors... but the rendering works now
Many of the charts now render in duplicate
@Leilani Greer I know you are probably out this weekend...but next week... if there is anyone with angular/react expertise this is becoming a blocking issue for us. From where we sit now, it appears as if the product cannot render multiple react components in Angular... this would render the product useless to us in Angular. This is very likely a gap in our knowledge of React and someone with more react knowledge might be able to figure it out. We are able to make it work in React 18, but the components don't render correctly... they render "double". In React 17 and below only one component will render at once.
Here is a video that further explains the issue: https://www.loom.com/share/c1d945ef0580462bb0abd4c256e400e5
If I had to guess I would say that the GoodData.UI react components are not canceling async operations before the component unmounts. As explained here: https://medium.com/doctolib/react-stop-checking-if-your-component-is-mounted-3bb2568a4934
l
Sorry, I have not been checking slack. 😉 @Jiri Zajic or @David Ramirez are either of you able to help? I know we can work with angular. I will also look later if we have any documentation about it.
v
hey no problem...totally didn't expect a response today
I am convinced it's the component unmount/cancel requests issue
if there were a bleeding edge develop branch...that supported React v18... we could use that... there is a workaround that seems to work with v18
Update on the issue... this behavior seems to be isolated to the Dashboard view... and the insight view appears to function correctly out of the box
and GD warned us... Dashboard is in beta... so heres hoping that behavior gets cleaned up
for our production use case...I think we would use the insightview anyway... so there you go... on to the next item
thanks @Leilani Greer for jumping in
j
Hello @Vincil Bishop! Thank you for the video, it's super helpful, even though we cannot see your source code. Do I understand correctly that the issue is when trying to render the Dashboard using the
<DashboardView />
component? And that it works correctly when you use
<InsightView />
to render individual insights? Can you please try the
<Dashboard />
component instead of
<DashboardView />
? The
<DashboardView />
component was an early Beta we eventually deprecated, because we decided to do a bigger refactoring of our Dashboards source code, and the outcome is that the
<DashboardView />
component has become deprecated, and you should now use the
<Dashboard />
component from
@gooddata/sdk-ui-dashboard
. If it's no longer an issue for you, don't worry about it. But if it is, we want make sure there are no blockers/ bugs on our side, and we would like to cooperate on resolving the issue!
v
Greetings and thanks for the reply. The issue is with the
<Dashboard/>
component. The
<DashboardView/>
I think would not work for whatever reason. The
<InsightView/>
component does not have the same issue as the
<Dashboard/>
component. I think if you look at the source code of the
<Dashboard/>
component, you will find that there are async operations, probably from axios that are not being canceled upon component unmount. I am not a react developer so it's hard for me to speak precisely about what's going on, but from everything it appears as though async operations are being completed and returning only to try and force an update on a component that has already unmounted. It would be nice to be able to use the
<Dashboard/>
component, but we are ok to use the
<InsightView/>
I think for now. Thanks!
👍 1