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

Ember 2.8.0 error while hitting view.parentView = null; in cleanupRenderNode in ember-htmlbars #14266

Closed
josemariaruiz opened this issue Sep 12, 2016 · 7 comments
Milestone

Comments

@josemariaruiz
Copy link

Hi,

I upgraded my app to 2.8.0 and now I get this error in the browser debugger.

ember.debug.js:6778 Uncaught Error: Assertion Failed: You must use Ember.set() to set the parentViewproperty (of <spa@component:md-card-content::ember940>) tonull.

This is interesting, as it's EmberJS telling me that something cannot be done (setting parentView directly) and yet ember-htmlbars does it.

Check

enifed('ember-htmlbars/hooks/cleanup-render-node', ['exports'], function (exports) {
  /**
  @module ember
  @submodule ember-htmlbars
  */

  'use strict';

  exports.default = cleanupRenderNode;

  function cleanupRenderNode(renderNode) {
    var view = renderNode.emberView;
    if (view) {
      view.renderer.willDestroyElement(view);
      view.ownerView._destroyingSubtreeForView.push(function (env) {
        view._transitionTo('destroying'); // unregisters view
        // prevents rerender and scheduling
        view._renderNode = null;
        renderNode.emberView = null;

        view.renderer.didDestroyElement(view);

        if (view.parentView && view.parentView === env.view) {
          view.parentView.removeChild(view);
        }
        view.parentView = null;

        view._transitionTo('preRender');
      });
    }

    if (renderNode.cleanup) {
      renderNode.cleanup();
    }
  }
});
@josemariaruiz
Copy link
Author

josemariaruiz commented Sep 12, 2016

I traced the problem back to the bower module (I don't know if that's the name) that you install with bower install.

The issue is described in this issue report: https://github.com/components/ember/issues/77

@rwjblue
Copy link
Member

rwjblue commented Sep 12, 2016

This is a duplicate of #14260. As I mentioned in that issue, you should generally not be observing parentView. Can you provide a reproduction / example of what you are doing?

@josemariaruiz
Copy link
Author

A git grep in my source code shows no use of parentView so I assume that the problem in in a third party.

I'm not doing anything strange in particular, app relays on ember-cli-materialize and it has a component called md-card-content.

Running the same code with EmberJS 2.7.0 (that version works flawlessly) I've got this warning:

DEPRECATION: The activatorproperty of<spa@component:md-card-reveal::ember875>is anEmber.Bindingconnected toparentView.activator, but Ember.Bindingis deprecated. Consider using analias computed property instead. [deprecation id: ember-metal.binding] See http://emberjs.com/deprecations/v2.x#toc_ember-binding for more details.

@rwjblue
Copy link
Member

rwjblue commented Sep 12, 2016

Wherever md-card-reveal is defined, is where the observer on parentView is being used.

@josemariaruiz
Copy link
Author

For instance, this code?

  title: alias('parentView.title'),
  titleClass: alias('parentView.titleClass'),
  activator: alias('parentView.activator'),

@rwjblue
Copy link
Member

rwjblue commented Sep 12, 2016

Yes, exactly.

@rwjblue
Copy link
Member

rwjblue commented Sep 13, 2016

Closed by #14281.

@rwjblue rwjblue closed this as completed Sep 13, 2016
jacobq pushed a commit to josemariaruiz/ember-cli-materialize that referenced this issue Jan 25, 2018
jacobq pushed a commit to josemariaruiz/ember-cli-materialize that referenced this issue Jan 25, 2018
jacobq pushed a commit to josemariaruiz/ember-cli-materialize that referenced this issue Jan 25, 2018
jacobq pushed a commit to josemariaruiz/ember-cli-materialize that referenced this issue Jan 25, 2018
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