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

Cannot unregister component template #12859

Closed
jakedetels opened this issue Jan 23, 2016 · 7 comments
Closed

Cannot unregister component template #12859

jakedetels opened this issue Jan 23, 2016 · 7 comments

Comments

@jakedetels
Copy link

The Ember.ApplicationInstance#unregister method fails to fully unregister a component template. See twiddle here: https://ember-twiddle.com/47dd2375c095cd7e73e5

I can successfully register a component template using:

let template = Ember.Handlebars.compile('<b>First x-foo</b>');
application.register('template:components/x-foo', template );

However, when I try unregistering this template followed by registering a different compiled template in its place, the original template is the one that gets rendered.

application.unregister('template:components/x-foo');
let newTemplate = Ember.Handlebars.compile('<b>New x-foo</b>');
application.register('template:components/x-foo', newTemplate );

In the twiddle demo, clicking "Register Template" will register the first compiled template. Then, clicking "Change Template" will first unregister the old template, followed by loading a new complied template. Yet when the component template is rendered, we still see the original compiled template. This demo utilizes the {{component}} helper to load the registered component template.

cc @dgeb (possibly related to commit 53267df)

@GavinJoyce
Copy link
Member

This behaviour is the same in ember 1.12.1 (twiddle) and 1.13.11 (twiddle).

@GavinJoyce
Copy link
Member

@GavinJoyce
Copy link
Member

@jakedetels how come you need to unregister a component and replace it at runtime? Can you just register both and use the component helper to switch at runtime?

@pixelhandler
Copy link
Contributor

@jakedetels I think the suggestion by @GavinJoyce makes sense and may be an elegant way to swap the components with the component helper

@pixelhandler
Copy link
Contributor

@mixonic do you think this is a bug?

@mixonic
Copy link
Sponsor Member

mixonic commented Mar 27, 2016

As we have no response from @jakedetels, I'm going to provisionally mark this wontfix and close it.

@mixonic mixonic closed this as completed Mar 27, 2016
@andyhot
Copy link

andyhot commented Aug 3, 2016

I believe a valid use-case for this is to support template hot-swapping

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

5 participants