FlowRouter.refresh('layout', 'template');layout{String} - [required] Name of the layout templatetemplate{String} - [required] Name of the intermediate template, simple<template>Loading...</template>might be a good option
FlowRouter.refresh() will force all route's rules and hooks to re-run, including subscriptions, waitOn(s) and template render.
Useful in cases where template logic depends from route's hooks, example:
in example above "yielded" template may loose data context after user login action, although user login will cause yield template to render - data and waitOn hooks will not fetch new data.
Meteor.loginWithPassword({
username: 'some@email.com'
}, 'password', error => {
if (error) {
/* show error */
} else {
/* If login form has its own `/login` route, redirect to root: */
if (FlowRouter._current.route.name === 'login') {
FlowRouter.go('/');
} else {
FlowRouter.refresh('_layout', '_loading');
}
}
});Meteor.logout((error) => {
if (error) {
console.error(error);
} else {
FlowRouter.refresh('_layout', '_loading');
}
});