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

Cannot disable interceptors (+workaround) #141

Open
simonflk opened this issue May 4, 2017 · 1 comment
Open

Cannot disable interceptors (+workaround) #141

simonflk opened this issue May 4, 2017 · 1 comment

Comments

@simonflk
Copy link

simonflk commented May 4, 2017

Hi, first of all I'd like to thank you for this cool project. I have found it very useful.
However, I've run into an issue and finally nailed it down to a problem with kakapo.

Background

My issue is that hot module reloading with the webpack dev server does not work when I am running kakapo. I'm not sure exactly the cause - I can see the XHR request for the hot update JSON, but the onreadystatechange callback never fires. Anyway, this is an aside, because I'm using fetch throughout my app, so I thought I would try to disable the XHR interceptor as I remember reading about this in the docs.

Issue

However, the example code doesn't work. I think it's because you're using _.merge in src/Router/index.js and it should instead be _.defaults:

this.routerConfig = _.defaults(routerConfig, routerDefaultConfig);

Example

    const router = new Router({
        strategies: ['fetch']
    });
    console.log(router.routerConfig.strategies); // ["fetch", "XMLHttpRequest"]

Workaround

Luckily I can work around it by poking around in the internals immediately after instantiating the router:

    const router = new Router();
    router.routerConfig.strategies = ['fetch'];
@zzarcon
Copy link
Member

zzarcon commented May 4, 2017

Thanks a lot for the issue, it looks like there is a bug in the lib as you mentioned!

The workaround works but it should not be necessary to do that... Do you think you can open a PR changing merge by defaults? We will really appreciate it!

Will make a release as soon as it goes merged ;)

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