You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say we have two components, mounted at same time:
functionSecondComponent(props:PluginProps):React.ReactElement<PluginProps>{constpluginApi: PluginApi=BbbPluginSdk.getPluginApi(props.pluginUuid);constcurrentUser=pluginApi.useCurrentUser();useEffect(()=>{console.log("User data in second component: ",JSON.stringify(currentUser?.data));},[JSON.stringify(currentUser?.data)]);return<></>;}
export defaultfunctionMainPluginComponent(props:PluginProps):React.ReactElement<PluginProps>{
BbbPluginSdk.initialize(props.pluginUuid);constpluginApi: PluginApi=BbbPluginSdk.getPluginApi(props.pluginUuid);constcurrentUser=pluginApi.useCurrentUser();console.log("User data in first component: ",JSON.stringify(currentUser?.data));return<><SecondComponent{...props}/></>;
Everything works great:
However, if the second component is mounted afterwards, like in below code:
functionSecondComponent(props:PluginProps):React.ReactElement<PluginProps>{constpluginApi: PluginApi=BbbPluginSdk.getPluginApi(props.pluginUuid);constcurrentUser=pluginApi.useCurrentUser();useEffect(()=>{console.log("User data in second component: ",JSON.stringify(currentUser?.data));},[JSON.stringify(currentUser?.data)]);return<></>;}
export defaultfunctionMainPluginComponent(props:PluginProps):React.ReactElement<PluginProps>{
BbbPluginSdk.initialize(props.pluginUuid);constpluginApi: PluginApi=BbbPluginSdk.getPluginApi(props.pluginUuid);constcurrentUser=pluginApi.useCurrentUser();const[displaySecondComponent,setDisplaySecondComponent]=useState(false);useEffect(()=>{setTimeout(()=>{setDisplaySecondComponent(true);},2000);},[]);useEffect(()=>{console.log("User data in first component: ",JSON.stringify(currentUser?.data));},[JSON.stringify(currentUser?.data)]);return<>{displaySecondComponent ?
<SecondComponent{...props}/>
:null}</>;}
Data never arrives into the second component:
The text was updated successfully, but these errors were encountered:
Let's say we have two components, mounted at same time:
Everything works great:
However, if the second component is mounted afterwards, like in below code:
Data never arrives into the second component:
The text was updated successfully, but these errors were encountered: