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

[BUGFIX canary] Support tagless components in fastboot #12829

Merged
merged 1 commit into from
Jan 18, 2016

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Jan 17, 2016

Attempting to render a component with tagName: '' in fastboot kills the fastboot server with a stack trace that looks like:

undefined:55214
      _emberViewsSystemJquery.default(rootElement).off('.ember', '**').removeC
                                     ^
TypeError: undefined is not a function
    at exports.default._emberRuntimeSystemObject.default.extend.destroy (<anonymous>:55214:38)
    at superWrapper [as destroy] (<anonymous>:33934:22)
    at <anonymous>:11887:16
    at eachDestroyable (<anonymous>:12166:9)
    at Object.Container.destroy (<anonymous>:11885:7)
    at Object.Backburner.run (<anonymous>:11256:25)
    at Object.run [as default] (<anonymous>:31959:27)
    at exports.default._emberMetalMixin.Mixin.create.willDestroy (<anonymous>:44068:36)
    at superWrapper (<anonymous>:33934:22)
    at _emberRuntimeSystemObject.default.extend.willDestroy (<anonymous>:15925:19)

The root cause is that initializing a tagless component causes a lookup of event_dispatcher:main. This actually succeeds, and the EventDispatcher doesn't try to do anything, but then during container teardown the EventDispatcher's destroy method throws the above exception.

To make any future bugs in this class more obvious, I added an assertion in EventDispatcher so that it will fail faster if you try to instantiate it in fastboot mode.

Attempting to render a component with `tagName: ''` in fastboot kills the fastboot server with a stack trace that looks like:

```
undefined:55214
      _emberViewsSystemJquery.default(rootElement).off('.ember', '**').removeC
                                     ^
TypeError: undefined is not a function
    at exports.default._emberRuntimeSystemObject.default.extend.destroy (<anonymous>:55214:38)
    at superWrapper [as destroy] (<anonymous>:33934:22)
    at <anonymous>:11887:16
    at eachDestroyable (<anonymous>:12166:9)
    at Object.Container.destroy (<anonymous>:11885:7)
    at Object.Backburner.run (<anonymous>:11256:25)
    at Object.run [as default] (<anonymous>:31959:27)
    at exports.default._emberMetalMixin.Mixin.create.willDestroy (<anonymous>:44068:36)
    at superWrapper (<anonymous>:33934:22)
    at _emberRuntimeSystemObject.default.extend.willDestroy (<anonymous>:15925:19)

```

The root cause is that initializing a tagless component causes a lookup of `event_dispatcher:main`. This actually succeeds, and the `EventDispatcher` doesn't try to do anything, but then during container teardown the EventDispatcher's `destroy` method throws the above exception.

To make any future bugs in this class more obvious, I added an assertion in `EventDispatcher` so that it will fail faster if you try to instantiate it in fastboot mode.
@stefanpenner
Copy link
Member

should we go down a null object pattern instead of branching?

@ef4
Copy link
Contributor Author

ef4 commented Jan 17, 2016

Do you mean registering a trivial stub object as event_dispatcher:main in fastboot mode?

rwjblue added a commit that referenced this pull request Jan 18, 2016
[BUGFIX canary] Support tagless components in fastboot
@rwjblue rwjblue merged commit 551a231 into master Jan 18, 2016
@rwjblue
Copy link
Member

rwjblue commented Jan 18, 2016

Note to self, since visit API is now stable this needs to be pulled in to release.

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 this pull request may close these issues.

3 participants