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

canDeactivate on route configuration not set #460

Open
jagretz opened this issue Mar 26, 2020 · 0 comments · May be fixed by #488
Open

canDeactivate on route configuration not set #460

jagretz opened this issue Mar 26, 2020 · 0 comments · May be fixed by #488

Comments

@jagretz
Copy link

jagretz commented Mar 26, 2020

Meta details

router5 v7.0.2
node    v12.15.0
npm     v6.13.4
OS Version: 10.0.18363 N/A Build 18363

Correct me if I am wrong, but it appears there is a bug with the canDeactivate lifecycle functions. They don't appear to be getting set when configured.

I narrowed this down to onRouteAdded(route). I manually added code for a if (route.canDeactivate) conditional, and things starting working as expected.

        function onRouteAdded(route) {
            if (route.canActivate)
                router.canActivate(route.name, route.canActivate);
            if (route.canDeactivate)
                router.canDeactivate(route.name, route.canDeactivate);

Let me know if this is correct and I'll try, and try to find some time to submit a pull-request with associated tests.

@ghost ghost linked a pull request Mar 2, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant