Closed SathishGovindaraju closed 6 years ago
@ctrlplusb (sorry for the tag) Would be really great if you could look into this ASAP :) Would love to get this scenario working :)
@SathishGovindaraju I take back the earlier comment. Actually, on further investigation of your issue, it seemed similar to what I was facing in #56 and to me, seems like a issue on react-tree-walker
which I have created here incase you are interested in chiming in - https://github.com/ctrlplusb/react-tree-walker/issues/27
Just thought I'd say this is all working for me. Try wrapping your resolve function in a promise. Maybe React Jobs is needing that. If that doesn't work, next try using the old webpack require.ensure instead of import. It's been close to a year so I can't even remember why I came to this (Lol), but here's how I do it and it works...
import { asyncComponent } from 'react-async-component';
export default asyncComponent({
resolve: () =>
new Promise(resolve =>
require.ensure(
[],
(require) => {
resolve(require('./admin'));
},
'admin',
),
),
name: 'admin',
});
@oyeanuj and @unleashit Thanks for your replies. I got it working without the need for react-async-component
. Instead, I pass in the component (as a dynamically-imported function) and resolve the component myself by calling it inside the work
before resolving other jobs
. This seems to work good for my scenario
I've added a demo of this here: https://razzle-async-components-and-data.now.sh/
Source linked 👍
@ctrlplusb Seems like the above link isn't working. Could you point me to the source if the link is down?
Thanks for all the nice libraries :)
I am finding it hard to make this
react-async-component
work withreact-jobs
. The following scenario does not work. Looks like it doesn't resolve the dynamic import before rendering. I usereact-async-bootstrapper
to do server-side rendering as described in the README.AsyncHomePage
is not rendered in the above scenario. Looks like the dynamic-import is not resolved on the server-side.Having said that, the following works when I change the order.
Now instead of passing
AsyncHomePage
to theDependencyResolver
, I am passing the normal component and dynamically import theDependencyResolver