-
Notifications
You must be signed in to change notification settings - Fork 510
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
Depended module config() and run() blocks being executed multiple times #77
Comments
If you don't use reconfig, it definitely shouldn't run those blocks twice. I'll take a look at it next week (sorry I'm at Paris for ng-europe, so I |
Thanks for your quick response! I've managed to distill my issue down to such a simple plunkr that I've been convinced for ages that I must be doing something wrong. Anyway, enjoy ng-europe :) |
I can fix this issue by changing the following code:
to this
which leads me to ask, why would you want to re-run the Incidentally, I was also having the same issue as detailed here: #58 (directives firing twice), and the above change stopped that from happening too. |
Initially it was made this way because you don't know the dependencies until you analyze the invoke queue. PS: I really need to add unit tests for all those special cases because I keep forgetting them (or add more comments) |
Fixed in 0.3.9, thanks for the plunkr it helped me narrow the problem down to a simple coding mistake that led to big consequences: the app module was not detected and its dependencies (it includes the config/run blocks) were not listed as already loaded ! |
Thanks for the fix, it does indeed fix the issue in the Plunkr. Unfortunately I don't think it solves #58, at least for me. I will try and create another plunkr encapsulating the problem that I'm seeing, but I think it reaches beyond simply having directives firing more than once. I think it's a fundamental problem with having behaviour that reruns the invoke queue and config blocks, even if angular has already loaded the module (and would have therefore already run these). I say this because when I apply my diff above, which explicitly doesn't rerun the config blocks or invoke queue if angular has already registered the module, it solves both #77 and #58 for me. |
The problem from #58 that is not solved with this fix is " Multiple directives [uiInputText, uiInputText] asking for template on: < div ................ >" ? |
Yes, that's the one - multiple directives (of the same name) trying to attach to the same element. I think that somewhere along the line, new I'm working on a Plunkr, but I'm running out of time today. It's proving hard functionality to extract because I've got ocLazyLoad plugged into a ES6 module loader in my app and I'm not sure whether that's part of the picture or not. I have some more time to look into it on Friday. |
Ok no problem, take your time. That's the kind of bug that my fix should prevent. |
Although I haven't managed to create a plunkr showing the directive issue, I have manage to get one together exhibiting an issue which I believe is related. http://plnkr.co/edit/2ZAbNpJX2skTMblvSlCY More information in the Plunkr itself. |
I've been playing around with ocLazyLoad for a while now and I've noticed something that I didn't expect.
It seems that if you register a module statically as a dependency on your application module, and then add a dependency to that same module from a lazy-loaded module, the depended module essentially runs twice; it's config() and run() blocks execute each time you lazy load a module which depends on it.
Is this expected behaviour?
Plunkr which reproduces the issue - observe the
console.log
output and then click the button.http://plnkr.co/edit/IKVZAB7omm2nlmpsK96a
Note that I'm not setting the
reconfig
flag...The text was updated successfully, but these errors were encountered: