Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

anonymousEndpoints feature with interceptor enabled fails with loading 2 templateUrls at once #345

Closed
ghost opened this issue Jul 14, 2016 · 4 comments

Comments

@ghost
Copy link

ghost commented Jul 14, 2016

deadlock
Running adal and adal-angular with ui-router introduces a problem.
When states have templateUrls defined, and you jump from level 1 state, into a nested level 3 state, two templates need to be loaded first. In my case /host-application/module-container.html and /modules/vacation/views/list.html

While some stuff in adal-angular pushes the /modules/vacation/views/list.html url into the anonymousEndpoints array, adal.js at about line 748 checks for the resource of /host-application/module-container.html, which hasn't been added to anonymousEndpoints yet, marking it as config.loginResource.

The stateChange is not triggered, because it waits for the template to be resolved, therefor the login doesn't trigger, which is supposed to continue the delayed call for the template. So it's kind of a deadlock situation:

The router waits for the template, the template waits for the login, the login waits for the stateChange in the router.

Heres a screenshot. I do not have time to make a minimal reproduction project.
The scenario in the screenshot is navigating from the state landingpage(templateUrl: "/host-application/landingpage.html") to the state modules.vacation.list(templateUrl: "/modules/vacation/views/list.html")

The extra layer from state modules.vacation doesn't require a call, as its template is defined statically:

        $stateProvider.state("modules.vacation", {
                url: "/modules/vacation",
                template: "<div class='module-content slideLeft-animation' ui-view></div>",
                requireADLogin: true
            }).state("modules.vacation.list", {
                url: "/modules/vacation/list",
                templateUrl: "/modules/vacation/views/list.html",
                controller: "vacation.listController",
                requireADLogin: true
            }).state("modules.vacation.create", {
                url: "/modules/vacation/create",
                templateUrl: "/modules/vacation/views/create.html",
                controller: "vacation.createController",
                requireADLogin: true
            });
        $stateProvider.state("landingpage", {
            url: "/landingpage",
            templateUrl: "/host-application/landingpage.html",
            controller: "host-application.landingpage"
        }).state("modules", {
            url: "/modules",
            templateUrl: "/host-application/module-container.html",
            controller: "host-application.module-container"
        });
@tushargupta51
Copy link
Contributor

tushargupta51 commented Jul 15, 2016

@max-buecker We are aware that the anonymousEndpoints solution is not complete as in it might not work well with nested states or template properties other than templateUrl: #326. For now, you can add "/host-application/module-container.html" to anonymousEndpoints in init method to fix this issue.

@ghost
Copy link
Author

ghost commented Jul 18, 2016

@tushargupta51 I've been aware of this workaround. It's currently working like this in my codebase.
Looking forward for a complete implementation of anonymousEndpoints. Any chances you can tell me rough scheduling of it?

@tushargupta51 tushargupta51 added this to the 1.0.12 milestone Jul 20, 2016
@tushargupta51
Copy link
Contributor

@max-buecker This is slated for our next release 1.0.12. We don't have any timelines to share yet. Will update once we have a date.

@tushargupta51
Copy link
Contributor

@max-buecker We have fixed this in 1.0.12. Please try it and let us know if you run into any issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants