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

compileWarningsToYellowBox assumes msg is a string #29

Closed
seantempesta opened this issue Mar 20, 2016 · 1 comment
Closed

compileWarningsToYellowBox assumes msg is a string #29

seantempesta opened this issue Mar 20, 2016 · 1 comment

Comments

@seantempesta
Copy link

I think figwheel-bridge.js has a regression:

function compileWarningsToYellowBox() {
    var log = window.console.log;
    var compileWarningRx = /Figwheel: Compile Warning/;
    window.console.log = function (msg) {
        if (msg.match(compileWarningRx) != null) {
            console.warn(msg);
        } else {
            log.call(window.console, msg);
        }
    };
}

This function assumes that msg is a string (it can also be a javascript/cljs object) and silently fails when match is called and it's not a string. Below is a fix. Also, I recommend just matching on "Figwheel Compile" as there are also "Figwheel Compile Exception"s.

function compileWarningsToYellowBox() {
    var log = window.console.log;
    var compileWarningRx = /Figwheel: Compile/;
    window.console.log = function (msg) {
        if (typeof msg.match === 'function' && msg.match(compileWarningRx) != null) {
            console.warn(msg);
        } else {
            log.call(window.console, msg);
        }
    };
}

So, I tried forking your repo and doing a pull request, but the forked repo was "natal". Now I'm certainly no github genius, but I think this is problematic.

Also, great work on the rewrite! Firebase is working out of the box now. :)

@drapanjanas
Copy link
Owner

True! Thanks, I will fix it as you proposed.

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