Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

States not gets enabled if there are nested lazy loaded states #696

Closed
bitakeyogesh opened this issue Jun 18, 2020 · 2 comments
Closed

States not gets enabled if there are nested lazy loaded states #696

bitakeyogesh opened this issue Jun 18, 2020 · 2 comments
Labels

Comments

@bitakeyogesh
Copy link

bitakeyogesh commented Jun 18, 2020

I am trying to load everything lazily, it works for one level routing, but it is not working for nested levels. It not works mean states are not getting enabled.
Here is the code.

import loadable from '@loadable/component';

export const loadLazyComponent = ( name, url, componentName, parent ) => {
    const component = loadable( () => import( `../example/${componentName}` ), {
        fallback: <div>Loading...</div>
    } );

    return {
        states: [ {
            name: name,
            ...url && { url: url },
            ...parent && { parent: parent },
            component: component
        } ]
    };
};
let states = [ {
        name: 'parent.**',
        url: '/parent',
        lazyLoad: () => loadLazyComponent( 'parent', '/parent', 'ParentPage' )
    },
    {
        name: 'child.**',
        url: '/child',
        parent: 'parent',
        lazyLoad: () => loadLazyComponent( 'child', '/child', 'ChildPage','parent' )
    }
];
export default states;

After trial and error i make it work by changing the parent of child future state, but with this If i direct load or refresh the /parent/child its not working.

image

Am i missing something or is it a bug?

@stale
Copy link

stale bot commented Dec 15, 2020

This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions!

@stale stale bot added the stale label Dec 15, 2020
@stale
Copy link

stale bot commented Dec 31, 2020

This issue has been automatically closed.

@stale stale bot closed this as completed Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant