kadirahq / fast-render

Render you app even before the DDP connection is live. - magic?
MIT License
560 stars 80 forks source link

FlowRouter and queryParams #131

Closed Cerealkillerway closed 8 years ago

Cerealkillerway commented 8 years ago

I use in my app flow-router 1.19.0 and fast-render 2.8.1; I have a simple route that makes a subscription using "lang" queryParam to find data for the current language:

PanelRoutes.route('/pages', {
    subscriptions: function(params, queryParams) {
        var options = {};
        options.fields = {
            _id: 1,
            code: 1
        };
        options.fields[queryParams.lang + '.title'] = 1;
        this.register("pagesList", subman.subscribe("findDocuments", 'Pages', {}, options));
    },
    action: function() {
        FlowLayout.render('panelLayout', {main: "pagesList"});
    } 
});

and on next browser refresh I get this error in the console:

error on fast-rendering path: /panel/pages?lang=en ; error: TypeError: Cannot read property 'lang' of undefined

Is it wrong/not possible to use queryParams with fast-render?

arunoda commented 8 years ago

This is an issue with FlowRouter and we've fixed in the latest version of FlowRouter. You need to use kadira:flow-router for this.