veliovgroup/Meteor-flow-router-title

Reactive title doesn't work

afrokick opened this issue · 2 comments

Page title doesn't change. Computation runs only one.

Example code for Collection:

import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
import { Mongo } from 'meteor/mongo';

const TestCollection = new Mongo.Collection('testColl', { connection: null });

Meteor.setInterval(() => {
  if (TestCollection.find({}).count()) {
    TestCollection.remove({});
  } else {
    TestCollection.insert({ counter: true });
  }
}, 1000);

Tracker.autorun(() => {
  const [s] = TestCollection.find({}).fetch();

  console.log(`Tracker: ${s ? 'founded' : 'not founded'}`);
});

FlowRouter.route('*', {
  name: 'App.notFound',
  action() {
    console.log('rendered');
  },
  title() {
    const [s] = TestCollection.find({}).fetch();

    return s ? 'founded' : 'not founded';
  },
});

Example code for ReactiveVar:

import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
 
const test = new ReactiveVar(1);
 
Meteor.setInterval(() => {
  test.set(test.get() + 1);
  console.log(`new:${test.get()}`);
}, 1000);
 
FlowRouter.route('*', {
  name: 'Test.name',
  action() {
    console.log('rendered');
  },
  title() {
    const t = test.get();
 
    console.log(`change title:${t}`);
 
    return `count ${t}`;
  },
});

Env:

  • Chrome 76.0.3809.132 (Official Build) (64-bit), OSX
  • Meteor 1.8.1
  • ostrio:flow-router-extra@3.6.3
  • ostrio:flow-router-title@3.1.5

#13 possible bugfix

Hello @afrokick 👋
Thank you for your contribution, released as v3.2.0.
Feel free to reopen it in case if the issue is still persists on your end.