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

exception on the process of destroying famousEach #263

Open
zerohun opened this issue Aug 7, 2015 · 0 comments
Open

exception on the process of destroying famousEach #263

zerohun opened this issue Aug 7, 2015 · 0 comments

Comments

@zerohun
Copy link

zerohun commented Aug 7, 2015

I have been trying to use famousEach but I'm seeing this exception when it's switching
templates by iron router. it happen every time when it's switching from a template that use famousEach to any other template

Exception from Tracker recompute function:
debug.js:41 Error: Expected template rendered with Blaze.render
at Object.Blaze.remove (http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2338:11)
at http://192.168.1.6:3000/packages/gadicohen_famous-views.js?aebf9b74ed8e53f3c6c01f5e7a0ba4485f43ca85:361:11
at Array.forEach (native)
at Function..each..forEach (http://192.168.1.6:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:156:11)
at fvWrapper.MeteorFamousView.destroy (http://192.168.1.6:3000/packages/gadicohen_famous-views.js?aebf9b74ed8e53f3c6c01f5e7a0ba4485f43ca85:359:5)
at fvNode.template.onDestroy (http://192.168.1.6:3000/packages/gadicohen_famous-views.js?aebf9b74ed8e53f3c6c01f5e7a0ba4485f43ca85:1008:22)
at http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3155:22
at Function.Template._withTemplateInstanceFunc (http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3476:12)
at fireCallbacks (http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3151:12)
at null. (http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3257:5)
debug.js:41 Exception in template helper: TypeError: Router.current(...).data is not a function
at Object.Template.Posts.helpers.posts (http://192.168.1.6:3000/client/views/posts.js?b1d5e4e9a73bff142356e805c194263339a4d425:3:33)
at http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2880:16
at http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1651:16
at http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2928:66
at Function.Template._withTemplateInstanceFunc (http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3476:12)
at http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2927:27
at Object.Spacebars.call (http://192.168.1.6:3000/packages/spacebars.js?7bafbe05ec09b6bbb6a3b276537e4995ab298a2f:172:18)
at http://192.168.1.6:3000/client/views/posts.jade.js?135912c4a0f64cd8637c3dd441d67691fb10f890:18:30
at wrappedArgFunc (http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2795:14)
at null. (http://192.168.1.6:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2599:26)

This is my code using famousEach

layout.jade

template(name="layout")
  +Scene
    +HeaderFooterLayout
      +Node id="tab" position = "[ 0, -300 ]"
        +Node position = "[ 0, 5 ]"
          +DOMElement
            img(src="/images/logo.png", width='250')
        +TabMenuLayout position="[ 300, 0 ]"
          +famousEach menuItems
            +Node 
              +DOMElement
                a.tab(href=url)
                  h3
                    | #{title}
      +Node id="content"
        +yield

posts.jade

template(name='Posts')
  +Node id="posts"
    +GridLayout id="grid"       
      +famousEach posts
        +post                                                 


template(name='post')
  +Node
    +DOMElement
      .center-block.text-center.post-item
        a(href="{{pathFor route='posts.show' data=this}}")
          .loading-bg
            img.img-circle(src='{{thumbUrl imageId isVideo}}')
          h4 {{title}}
        a.user-link(href="{{pathFor route='users.show' data=user}}")   
          em By {{user.username}}

I was trying to find out the problem with debugging,
In meteorFamousView.js, I found that child.blazeView is undefined, when it's iterating, when child is pointing famousEach

MeteorFamousView.prototype.destroy = function(isTemplateDestroy) {
  var fview = this;

  if (isTemplateDestroy && fview._destroyPrevented)
    return fview._destroyPrevented();

  log.debug("Destroy (start) of " + this.type + " (#" + this.id + ") from " + this._source + ": children, components");                                                                                              

  // TODO, tests
  _.each(this.children, function(child) {
    //child.destroy();
    Blaze.remove(child.blazeView);
  });
......

I'm not sure if it's a bug or I'm using famousEach wrong way.

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

1 participant