filog
filog copied to clipboard
Possible conflict with FlowRouter
I'm currently unavailable to debug this further, but I noticed a possible issue:
I was finishing up testing FiLog (1.6), and as a final step I tried logging every route change from FlowRouter like this:
const trackRouteEntry = (context) => {
logger.debug(`Route entry ${context.path}`, context.queryParams);
};
FlowRouter.triggers.enter([trackRouteEntry]);
I had setup FiLog like this:
// /client/main.js
const consoleSender = new ConsoleSender();
const meteorSender = new MeteorClientHttpSender(Meteor.absoluteUrl('/logger'));
const teeSender = new TeeSender([meteorSender, consoleSender]);
logger = new ClientLogger(new LeveledStrategy(
teeSender,
teeSender,
teeSender
));
logger.processors.push(
new BrowserProcessor(),
new RoutingProcessor()
);
logger.arm();
Now, if I check what happens to FlowRouter's state, it's Router.queryParamsis populated by data from logger, depending on the processors in use:
{"browser":{"platform":"MacIntel","product":"Gecko","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36","performance":{}},"routing":{"location":{"hash":"","search":"","pathname":"/","port":"3000","hostname":"localhost","host":"localhost:3000","protocol":"http:","origin":"http://localhost:3000","href":"http://localhost:3000/","ancestorOrigins":{}}},"timestamp":{"log":1479647232743}}
And the next time I try to call
FlowRouter.setQueryParams({
randomParam: 5,
anotherParam: true
});
all that stuff from FiLog ends up in my path / browser address bar.
I made a reproduction: https://github.com/arggh/filog-router-issue
Looks like we are overwriting a global symbol. Weird. No time to look into it today and we don't have this problem with ReactRouter either, so not sure when I'll have the time to address this.