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

Async Support? #41

Closed
kesne opened this issue Jul 10, 2015 · 5 comments
Closed

Async Support? #41

kesne opened this issue Jul 10, 2015 · 5 comments

Comments

@kesne
Copy link

kesne commented Jul 10, 2015

Any plans or idea on adding support for asynchronous rendering?

For example, allowing the following example to work.

elementOpen('div', '', null);
setTimeout(function() {
  text('hi');
  elementClose('div');
}, 1000);
@cramforce
Copy link
Contributor

This is typically only desirable for server side rendering. Since our initial goal is to support existing templating languages those could just use their existing string generation instead.

@kesne
Copy link
Author

kesne commented Jul 10, 2015

Dust.js is a pretty popular templating engine with asynchronous support. I'm sure there are other engines out there that support async rendering as well.

@cramforce
Copy link
Contributor

@kesne Oh, I've implemented a few of those myself. Just saying it is typically a very bad idea on the client because it leads to uncontrollable re-layouts.

If this comes up as something people want we can make something like this work

elementOpen('div', '', null);
var context = saveContext();
setTimeout(function() {
  restoreContext(context);
  text('hi');
  elementClose('div');
}, 1000);

But I don't see very high priority.

@sparhami
Copy link
Contributor

I would also be concerned about people potentially kicking off a second render while the first is in progress, which could lead to strange behavior.

One reason why I think async rendering generally isn't handled by virtual DOM implementations is that invoking a render again when you have more data usually isn't too bad.

@kesne
Copy link
Author

kesne commented Jul 12, 2015

@cramforce I see your concern with it now. I think it's only dangerous if you don't have some sort of control between when re-layouts occur. Though I understand it being low-priority or generally out of scope for the project.

@sparhami That's true, I guess that's the alternative approach to this. Though if you have a cascading async layout it might get less-than-ideal. Although I guess if your site is structured like that you probably have bigger problems...

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

3 participants