Closed daryl-williams closed 4 years ago
I can confirm I have same issue.
I am using helper :
{{#if isUpvoted}} Show template A {{else}} Show template B {{/if}}
After user upvotes and helper changes to "true" it the page will refresh the new template then immediately go back to previous template and helper suddenly returns "false". The upvote is correctly changed in MongoDB. Only page force refresh shows the correct template. And I recently updated app from 1.2.1 Meteor to latest 1.4. Also updated Flowrouter to latest version.
I could fix some problems with FlowRouter.refresh() maybe you can try that after click event?
Hello folks, I am new to flow-router and Meteor and I am trying to narrow down where the problem might be. The problem is this: On clicking a button I want the browser to go to a new page, which it does ok, but then it immediately returns to the previous page with any user interaction. I am not sure that this is a flow-router issue, but as I said I am trying to figure out where the problem is and the router seems like a good place to start.
The app is pretty basic, there are just two pages, the first page contains a list of text files with song names represented by an un-ordered list and a second page to display the song when it is selected by clicking on the
Following are my routes as defined in the client/routes.js file:
Accounts.onLogin(function () { FlowRouter.go('/dashboard'); })
FlowRouter.route('/dashboard', { name: 'dashboard', action: function(params, queryParams) { console.log('/lib/routes.js: Page = /dashboard'); BlazeLayout.render("Members", {memberContent: "Dashboard"}); } });
FlowRouter.route('/song/:name', { name: 'song', action: function(pathParams, queryParams) { console.log('/lib/routes.js: Page = /song/:name');; BlazeLayout.render("Members", {memberContent: "SongPage"}); }, });
Here are my Templates:
{{> Template.dynamic template=memberContent }}{{#each getSongs}}- {{title}}
{{/each}}
and here are the template helpers:
Template.Members.helpers({ 'getTemplateName': function() { var route = FlowRouter.getRouteName(); if (route === 'dashboard') { template = 'Dashboard'; } else if (route === 'song') { template = 'SongPage'; } else { template = 'Dashboard'; } return template; }, });
Template.SongPage.helpers({ 'getSong': function() { var currentSong = Session.get('currentSong'); return (currentSong !== undefined) ? Spacebars.SafeString(currentSong) : ''; } }, });
Any and all help would be much appreciated. If I can provide any further information please let me know. I really need to nail down if the problem is with the routing or some other newbie mistake.
Thanks and Regards,
Daryl