-
Notifications
You must be signed in to change notification settings - Fork 93
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
Changes in scope hierarchy cause errors (NGI.InspectorAgent.inspectScope is not a function) #146
Comments
Ok so I've built a minimal test case: http://run.plnkr.co/plunks/CBpoKcZUnU7hUlvkVGW1/ The issue happens whenever the list of a scope's children changes. Though error on line 62 aborts the function before the child list can be updated, so some changes won't even trigger the error. (e.g. in the sample, the error doesn't fire when removing the child: the parent's So really the surface issue here is that changes in the scope hierarchy are not reflected in the inspector when the pane is open. I'm pretty confident now that the cause is the circular dependency shown above. Do you guys have a strong opinion on the best direction forward? You could delay the |
Nooooooo, circular dependency issue! Thanks for the report @tdhsmith. I thought I had broken all the circular deps when migrating the extension to browserify, but apparently I missed one (Madge confirms this). ┌─[andrew] [master → origin ✓] [~/Documents/ng-inspector/src/js]
└─▪ madge --circular .
InspectorAgent -> Scope In regards to the solution, my preference would be to decouple the modules a bit more to the point that whatever functionality is creating the circular dep be broken out to a 3rd module. We are trying to plan out some bigger architectural changes to the extension right now that would likely help with that, but I suspect those are going take quite a while. It would probably be a good idea if we patch this in the meantime. I can't give an explicit suggestion for a fix atm because I simply haven't spent enough time looking at that part of the codebase recently, but I think we're very open to suggestion if you want to take a whack at it. |
In the interest of avoiding errors for end-users, I think we should go with a super ugly, but effective patch for the time being. I've been using the extension a bit tonight working on some other stuff and the errors are pretty frustrating. module.exports = InspectorAgent;
var NGI = {
Scope: require('./Scope')
}; Like you mentioned @tdhsmith, we'll just delay the require for now until |
I'm getting a
TypeError: NGI.InspectorAgent.inspectScope is not a function
in my current app, triggered atScope.js
line 62. After some initial digging, I think the issue might be a circular dependency here:AFAICT,
NGI.InspectorAgent
is an empty object withinScope.js
, which seems to match with the dependency graph, but I'm also not very knowledgable in advanced module stuff, so I could be jumping to conclusions.Haven't figured out the exact trigger or isolated it yet, but I think it's related to automatic unwrapping of
$resource
requests while the inspector is looking at them. If the above guess is correct though, it might be triggering on any cases where that watcher sees new children in an open scope?Will try to come back to this in the next couple days with a minimal demo.
The text was updated successfully, but these errors were encountered: