AdamBrodzinski / meteor-generate

Meteor Generate - A Rails Inspired File Generator for Meteor
MIT License
65 stars 2 forks source link

mgen publication doesn't do anything #7

Closed wizonesolutions closed 9 years ago

wizonesolutions commented 9 years ago

It just noops; is it not actually written, but just documented in the README? It doesn't even give an error.

AdamBrodzinski commented 9 years ago

Good catch! I just updated the readme. It should be 'mgen publish post:userPost'. This reminds me... I need to look into the command lib and see if I can throw the help screen if a command isn't found.

Thanks! :beers:

wizonesolutions commented 9 years ago

Cool. Does publish also subscribe to the publication, or is that not in meteor-generate yet?

AdamBrodzinski commented 9 years ago

I thought about adding that but I'm not sure what the most universal pattern is.

A lesson learned in blonk is that you need to unsubscribe from them as soon as possible to keep things fast, so subscribing at startup is expensive.

Currently there are commented out subscriptions in the index, show and edit controllers that use posts and post subscriptions. This way IR can cleanup the sub when changing routes, and FastRender can be used to cache those if it's going to be reused soon.

This pattern seems to be the fastest on the client and server both.

wizonesolutions commented 9 years ago

Huh, OK. So subscribing in the waitOn is actually generally best? Noted.

AdamBrodzinski commented 9 years ago

Yep in general. However using subscriptions also works... its the same but will not wait, the route will just re-run again once the data comes in. Also recently in 1.0.4 they added template level subscriptions which automatically unsubscribe before the templates are destroyed (to prevent leaks).. I haven't tried this yet but it makes a lot of sense for "component" level stuff (for instance a weather widget that could be on any page).