View renderer functions don't work with Deferreds #486

Closed
daffl opened this Issue Sep 27, 2013 · 2 comments

Comments

Projects
None yet
3 participants
@daffl
Contributor

daffl commented Sep 27, 2013

As reported in #484, view renderer functions do not resolve when passing a Deferred. It should however work the same way as using can.view(id, deferred) directly.

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Sep 27, 2013

I'm actually not sure if it's possible or makes sense... can.view() does all Deferred-related magic currently (as well as wrapping renderer into can.view.frag() call for live binding). While renderer is just a function, which comes from can/view/ejs or can/view/mustache and renders template. So, as for me it makes sense to let can.view() to make its current job, which includes lazy model initialization. Just need to let can.view() accepts renderer function as a first argument (as proposed in #484). It's an easy fix. And it also consistent.

I'm actually not sure if it's possible or makes sense... can.view() does all Deferred-related magic currently (as well as wrapping renderer into can.view.frag() call for live binding). While renderer is just a function, which comes from can/view/ejs or can/view/mustache and renders template. So, as for me it makes sense to let can.view() to make its current job, which includes lazy model initialization. Just need to let can.view() accepts renderer function as a first argument (as proposed in #484). It's an easy fix. And it also consistent.

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Sep 27, 2013

Contributor

That is a good point and seeing as this doesn't work as I though it did, your suggested fix makes sense and would probably make less of an impact on the API. I was just thinking that renderer functions should work the same way as a can.view call. We will definitely get that into the next release.

Contributor

daffl commented Sep 27, 2013

That is a good point and seeing as this doesn't work as I though it did, your suggested fix makes sense and would probably make less of an impact on the API. I was just thinking that renderer functions should work the same way as a can.view call. We will definitely get that into the next release.

@ghost ghost assigned imjoshdean Oct 1, 2013

@imjoshdean imjoshdean closed this in a2e22cc Oct 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment