Giter Club home page Giter Club logo

Comments (7)

arunoda avatar arunoda commented on July 28, 2024

You should not use this.register inside the action. I you can that's a bug in Flow Router.

There is a reason for that we've a subscriptions in the router.

  • We believe subscriptions are aligned to a route most of the time.
  • For fast-render we need to run subscriptions on the server

That's why we have something like this.
But, we don't need to wait for subscriptions. That's why we only register it. Later you can check for the status.

And we've .ready()API which can check for the readyness for multiple subscriptions at once. It's simple useful helper function.

from flow-router.

steph643 avatar steph643 commented on July 28, 2024

Thanks @arunoda, understood.

My feeling is that maybe there is a simpler way to use your package that what is explained in the doc (for those who don't use fast-render and don't attach subscriptions to routes). I'll try to write an alternate manual if I have time.

Regarding the ready API, since I never attach subscriptions to a route, I use Template.subscriptionsReady instead.

from flow-router.

arunoda avatar arunoda commented on July 28, 2024

You need to have action method for the route. Otherwise you need to do some logic to pick the route and do the rendering.

from flow-router.

arunoda avatar arunoda commented on July 28, 2024

Yes. You can leave it alone. Both subscription and action are optional. May
be I can add it to docs.
On 2015 මාර්තු 12, බ්‍රහස් at ප.ව. 7.25 steph643 [email protected]
wrote:

Thanks @arunoda https://github.com/arunoda, understood.

My feeling is that maybe there is a simpler way to use your package that
what is explained in the doc (for those who don't use fast-render and don't
attach subscriptions to routes). I'll try to write an alternate manual if I
have time.

Regarding the ready API, since I never attach subscriptions to a route, I
use Template.subscriptionsReady
https://github.com/meteor/meteor/blob/devel/History.md#blaze instead.


Reply to this email directly or view it on GitHub
#34 (comment)
.

from flow-router.

arunoda avatar arunoda commented on July 28, 2024

Yeah. I am quite happy to add a link to that manual on the read me.
On 2015 මාර්තු 12, බ්‍රහස් at ප.ව. 7.30 Arunoda Susiripala <
[email protected]> wrote:

Yes. You can leave it alone. Both subscription and action are optional.
May be I can add it to docs.
On 2015 මාර්තු 12, බ්‍රහස් at ප.ව. 7.25 steph643 [email protected]
wrote:

Thanks @arunoda https://github.com/arunoda, understood.

My feeling is that maybe there is a simpler way to use your package that
what is explained in the doc (for those who don't use fast-render and don't
attach subscriptions to routes). I'll try to write an alternate manual if I
have time.

Regarding the ready API, since I never attach subscriptions to a route,
I use Template.subscriptionsReady
https://github.com/meteor/meteor/blob/devel/History.md#blaze instead.


Reply to this email directly or view it on GitHub
#34 (comment)
.

from flow-router.

dandv avatar dandv commented on July 28, 2024

I was going to ask something similar: since you can run any code in subscriptions, you can run rendering as well. Then what is the point of action?

FlowRouter.route('/blog/:postId', {
    subscriptions: function(params, queryParams) {
        this.register('myPost', Meteor.subscribe('blogPost', params.postId));
        FlowLayout.render('componentLayout', {content: ...});
    }
    // no need for `action`
});

I'm new to Flow-Router, so please pardon my ignorance :)

from flow-router.

arunoda avatar arunoda commented on July 28, 2024

subscriptions is different. I runs inside a autorun for managing
subscriptions (auto unsub.)
It also runs on the server.

Actions is a simply a function.

On Thu, Jun 4, 2015 at 4:36 PM Dan Dascalescu [email protected]
wrote:

I was going to ask something similar: since you can run any code in
subscriptions, you can run rendering as well. Then what is the point of
action?

FlowRouter.route('/blog/:postId', {
subscriptions: function(params, queryParams) {
this.register('myPost', Meteor.subscribe('blogPost'

, params.postId));
FlowLayout.render('componentLayout', {content: ...});
}
...
});

I'm new to Flow-Router, so please pardon my ignorance :)


Reply to this email directly or view it on GitHub
#34 (comment)
.

from flow-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.