Re: [Dev] Avoid loading multiple copies of React

2018-02-19 Thread Aruna Herath
On Tue, Feb 20, 2018 at 10:14 AM, SajithAR Ariyarathna wrote: > > > On Tue, Feb 20, 2018 at 9:47 AM, Nisala Nanayakkara > wrote: > >> Hi Sajith, >> >> No. I think what we are going to do here is to refer the 'React' which is >> initialized by the dashboard

Re: [Dev] Avoid loading multiple copies of React

2018-02-19 Thread SajithAR Ariyarathna
On Tue, Feb 20, 2018 at 10:18 AM, Nisala Nanayakkara wrote: > Hi Sajith, > > We need to document this (putting React as an external dependency and >> using global.React). Is there any docs ATM? >> > > No. We do not add this to document yet. We need to improve the documents >

Re: [Dev] Avoid loading multiple copies of React

2018-02-19 Thread Nisala Nanayakkara
Hi Sajith, We need to document this (putting React as an external dependency and using > global.React). Is there any docs ATM? > No. We do not add this to document yet. We need to improve the documents related "Creating Custom Widgets"[1] with this change. [1] -

Re: [Dev] Avoid loading multiple copies of React

2018-02-19 Thread SajithAR Ariyarathna
On Tue, Feb 20, 2018 at 9:47 AM, Nisala Nanayakkara wrote: > Hi Sajith, > > No. I think what we are going to do here is to refer the 'React' which is > initialized by the dashboard parent app from the widget level. So setting > the React in global context(global.React = React)

Re: [Dev] Avoid loading multiple copies of React

2018-02-19 Thread Nisala Nanayakkara
Hi Sajith, No. I think what we are going to do here is to refer the 'React' which is initialized by the dashboard parent app from the widget level. So setting the React in global context(global.React = React) should be done in the Dashboard parent app. So that we can refer it from widgets by

Re: [Dev] Avoid loading multiple copies of React

2018-02-19 Thread SajithAR Ariyarathna
Hi Nisala, global.React = React > Can we do above in the parent Widget ( https://www.npmjs.com/package/@wso2-dashboards/widget)? So that the some widget author doesn't need React as a dependency. On Thu, Feb 15, 2018 at 1:22 PM, Nisala Nanayakkara wrote: > Hi Aruna, > > +1

Re: [Dev] Avoid loading multiple copies of React

2018-02-14 Thread Nisala Nanayakkara
Hi Aruna, +1 for the approach. We have faced a similar issue in Product SP and tested the above-mentioned fix in our local environment. It is working fine. Thanks, Nisala On Thu, Feb 15, 2018 at 12:04 PM, Aruna Herath wrote: > Loading multiple copies of React in the same page

[Dev] Avoid loading multiple copies of React

2018-02-14 Thread Aruna Herath
Loading multiple copies of React in the same page creates problems , such as errors with discriptions like "Element ref was specified as a string (myRefName) but no owner was set. You may have multiple copies of React