ctrlplusb/react-async-component

Two same simultaneously async components

Magnielcz opened this issue · 5 comments

I have one async component which I'm using multiple times across application. One use case is, I'm rendering same component twice (with different props). But after resolving async component, only first component is re-rendered. Second one is stuck at loading phase. Let me show you, what I mean.

Simple ComponentAsync:

import { asyncComponent } from 'react-async-component';

export default asyncComponent({
	resolve: () => import( './Component'),
	LoadingComponent: () => <div>Loading component</div>
});`

Multiple using of async component:

import ComponentAsync from './ComponentAsync';

...

render()
{
   return (
      <ComponentAsync id={1} />
      <ComponentAsync id={2} />
    );
}

My first thought was, the problem is in needToResolveOnBrowser function.
For first component returns true and component is continue to resolving module. For next one is returns false, even the async component is still unresolved. After a while, I think it's wanted behavier, but I'm missing the piece of code, where and what should cause re-render for my second async component after first component is resolved.

@ctrlplusb @Magniel I have the same issue. I have an editor component being rendered async, and in pages where there are more than one of them, it intermittently doesn't load even though I can see the file loaded in the Network panel.

Any solutions/workarounds?

@oyeanuj I switch to 'react-loadable'. It has advanced functionality, very similar syntax and renders multiple instances of async component at once correctly.

We are having the exact same issue as @Magniel, is there any update on this @ctrlplusb?

Hey,

There's no other way to reach out you I guess. My name is Jim Ferguson. I'm working on a ionic/angular app. you made a post about web share last month. I was wondering if you have any suggestions for how to post a image to the share sheet or straight to the Instagram app on iOS to start a post for the user with my image attached?

you posted in:
microsoft/TypeScript#18642

I know this is out of the blue, but this has been killing me for over a week now.

Please reach out at your earliest convenience.

Thank you

Jim

Hey,

There's no other way to reach out you I guess. My name is Jim Ferguson. I'm working on a ionic/angular app. you made a post about web share last month. I was wondering if you have any suggestions for how to post a image to the share sheet or straight to the Instagram app on iOS to start a post for the user with my image attached?

you posted in:
microsoft/TypeScript#18642

I know this is out of the blue, but this has been killing me for over a week now.

Please reach out at your earliest convenience.

Thank you

Jim

Hi, I used Web Share on Android platform for sharing recorded video. Last time I was digging into Web Share API, Safari on iOS did not support Web Share level 2 (= file share), so I'm sorry, I don't think it is possible at this moment.