rendrjs / rendr

Render your Backbone.js apps on the client and the server, using Node.js.
MIT License
4.09k stars 312 forks source link

Some views seem to still be rendered twice on the client #461

Closed ingiulio closed 9 years ago

ingiulio commented 9 years ago

While playing with our app, I noticed the following into the normal flow of shared/base/view.js:

[
  childView1, 
  childView2,
  childView3,
  childViewOfChildView1
]
[ childViewOfChildView1 ]

I hope I made this clear enough. If that's not the case, please let me know and I'll try to provide a better explanation. This issue gave me a bit of headache :)

A fix for this would be as easy as just adding this

if(!$el.data('view-attached'))

before this line: https://github.com/rendrjs/rendr/blob/master/shared/base/view.js#L331 Or rather, we could probably mark and filter out subviews from the initial array, but that would definitely take more time and work.

Does this all make sense? Please let me know if I'm just missing something instead.

ingiulio commented 9 years ago

On a second thought about the fix, that should probably go even before the view is created, so before this line: https://github.com/rendrjs/rendr/blob/master/shared/base/view.js#L460 I'll just file a PR

ingiulio commented 9 years ago

Fixed by #463