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

Problem with Chrome Debugger when using spread operator #1280

Closed
ghost opened this issue May 14, 2015 · 15 comments
Closed

Problem with Chrome Debugger when using spread operator #1280

ghost opened this issue May 14, 2015 · 15 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@ghost
Copy link

ghost commented May 14, 2015

The following code works on the Simulator:

return Promise.all([fileInfo, ...(m.intoArray(setValuePromises))]);

but gives a Syntax error when I try to debug with Chrome.

@sahrens
Copy link
Contributor

sahrens commented May 16, 2015

cc @amasad - missing transform?

@sebmck
Copy link
Contributor

sebmck commented May 17, 2015

The JavaScript wouldn't be going through any transforms because it's just being executed natively.

@sahrens
Copy link
Contributor

sahrens commented May 17, 2015

The JS is still transformed to generate the bundle which is loaded by chrome.

@ghost
Copy link
Author

ghost commented May 20, 2015

Still confused. Should it work ?

@sebmck
Copy link
Contributor

sebmck commented May 20, 2015

It shouldn't work and there's probably no real way to make it work.

On Wednesday, 20 May 2015, Roger Gilliar notifications@github.com wrote:

Still confused. Should it work ?

Reply to this email directly or view it on GitHub
#1280 (comment)
.

Sebastian McKenzie

@ide
Copy link
Contributor

ide commented May 20, 2015

@sebmck I believe it should work. RN deploys ES5... in theory with ES3 support RN could run in IE8 if we wanted. Something is going wrong with the transform that's causing Chrome to receive a maltransformed spread operator.

@RogerGL can you view the JS that is running in Chrome and see what the code around your Promise.all call looks like?

@ghost
Copy link
Author

ghost commented May 20, 2015

This is the complete method:

  var setContent = (result) => {
        var fileInfo = result[0];
        var setValuePromises = m.map((data) => {
            return Store.setValue(m.get(data, "fileName"), m.get(data, "content"));
        }, fileInfo);
        return Promise.all([fileInfo, ...(m.intoArray(setValuePromises))]);
    };

@ide
Copy link
Contributor

ide commented May 20, 2015

@RogerGL, sorry - I meant the code that Chrome's web inspector shows under the Sources tab. Things like the arrow functions should be transformed into normal functions.

@ghost
Copy link
Author

ghost commented May 20, 2015

Chrome displays the code given in the previous posting.

This is the code from the index.ios.bundle file:

   var setContent = function(result)  {
        var fileInfo = result[0];
        var setValuePromises = m.map(function(data)  {
            return Store.setValue(m.get(data, "fileName"), m.get(data, "content"));
        }, fileInfo);
        return Promise.all([fileInfo, ...(m.intoArray(setValuePromises))]);
    }; 

@sahrens
Copy link
Contributor

sahrens commented May 20, 2015

Hopefully this will be fixed when we switch to babel soon.

@ide
Copy link
Contributor

ide commented May 20, 2015

@RogerGL: thanks. Looks like a transform bug.

The best workaround now is to write a manual array.concat call until the transform pipeline uses babel as @sahrens mentioned.

@sebmck
Copy link
Contributor

sebmck commented May 20, 2015

@ide Oh right. Sorry for speaking out of turn. I thought he was referring to the dev tools console.

@amasad
Copy link
Contributor

amasad commented May 20, 2015

Yeah, I hate this discrepancy. JavaScript Core has rest param support whereas chrome doesn't. Pushing the switch to Babel shortly, and it should include this transform.

@amasad amasad self-assigned this May 20, 2015
@ghost
Copy link
Author

ghost commented May 21, 2015

Good to know that babel is coming

@ide
Copy link
Contributor

ide commented May 28, 2015

Babel landed in master: tadeuzagallo@56d6ee3

@ide ide closed this as completed May 28, 2015
@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants