Skip to content

Template didn't rerender when 2 routes render the same template #72

Open
@ArthurGerbelot

Description

@ArthurGerbelot

I have 2 route / and /sell linked to the same Template, but when I switch from one to the other, the template isn't reloaded (so ReactiveVar aren't updated).

This is my router:

FlowRouter.route('/', {
  name: "dashboard",
  action() {
    console.log('go to buy');
    BlazeLayout.render("layout", {nav: "publicNav", main: "dashboard"});
  }
});
FlowRouter.route('/sell', {
  name: "dashboard-sell",
  action() {
    console.log('go to sell');
    BlazeLayout.render("layout", {nav: "publicNav", main: "dashboard"});
  }
});

And the basic template onCreated function:

Template.dashboard.onCreated(function () {
  console.log('Route name: ', FlowRouter.current().route.name)
})

So whem I call / and I try to switch multiple times, I got:

go to buy
Route name:  dashboard
go to sell
go to buy
go to sell

And When I start with /sell (hard refresh) I got:

go to sell
Route name:  dashboard-sell
go to buy
go to sell

How can I avoid that ? Or at least bind a function on this update event ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions