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

Dynamically wire()'ed scopes are not made resolvable #121

Open
AnAppAMonth opened this issue Jul 13, 2013 · 2 comments
Open

Dynamically wire()'ed scopes are not made resolvable #121

AnAppAMonth opened this issue Jul 13, 2013 · 2 comments

Comments

@AnAppAMonth
Copy link

Objects (components and scopes) are made resolvable by calling Scope.prototype._makeResolvable(). This method is called in the following places:

  1. Scope.prototype._createScopeItem()
  2. scope.componentFactory.initInstance()
  3. pluginApi.addComponent()
  4. pluginApi.addInstance()

The first call causes _makeResolvable() to be called for each statically created component and scope (those created by wiring a spec); and the second call causes it to be called for each component, either statically or dynamically created. By "dynamically created" I mean it's created by calling wire() in a plugin method.

So for statically created components, _makeResolvable() is called twice (both 1 and 2 are called); for statically created scopes, 1 is called; for dynamically created components, 2 is called; and for dynamically created scopes, none is called, so the scope isn't resolvable.

For example, if I have the following statement in a plugin method:
wire({example:{literal:'example'}}, 'myscope');
This scope is created but not made resolvable.

Additionally, pluginApi.addComponent() calls scope.componentFactory.processComponent(), which in turn calls scope.componentFactory.initInstance(). So in this case _makeResolvable is also called twice (2 and 3).

@AnAppAMonth
Copy link
Author

Additionally, components that are dynamically wired and are plain values or reference another component, for example, by calling wire(3, 'newcomp') or wire({$ref: 'another'}, 'newcomp') in a plugin, are not made resolvable.

@briancavalier
Copy link
Member

Thanks for the detailed report, @halfninety. I'll look into this today and report back with more info.

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

No branches or pull requests

2 participants