Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible conflict with FlowRouter #14

Open
arggh opened this issue Nov 20, 2016 · 2 comments
Open

Possible conflict with FlowRouter #14

arggh opened this issue Nov 20, 2016 · 2 comments

Comments

@arggh
Copy link
Contributor

arggh commented Nov 20, 2016

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.

@arggh
Copy link
Contributor Author

arggh commented Nov 20, 2016

I made a reproduction: https://github.com/arggh/filog-router-issue

@fgm
Copy link
Owner

fgm commented Nov 20, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants