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
rogergl opened this Issue May 14, 2015 · 15 comments

Comments

Projects
None yet
6 participants
@rogergl

rogergl 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

This comment has been minimized.

Show comment
Hide comment
@sahrens

sahrens May 16, 2015

Contributor

cc @amasad - missing transform?

Contributor

sahrens commented May 16, 2015

cc @amasad - missing transform?

@kittens

This comment has been minimized.

Show comment
Hide comment
@kittens

kittens May 17, 2015

Member

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

Member

kittens commented May 17, 2015

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

@sahrens

This comment has been minimized.

Show comment
Hide comment
@sahrens

sahrens May 17, 2015

Contributor

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

Contributor

sahrens commented May 17, 2015

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

@rogergl

This comment has been minimized.

Show comment
Hide comment
@rogergl

rogergl May 20, 2015

Still confused. Should it work ?

rogergl commented May 20, 2015

Still confused. Should it work ?

@kittens

This comment has been minimized.

Show comment
Hide comment
@kittens

kittens May 20, 2015

Member

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

Member

kittens 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

This comment has been minimized.

Show comment
Hide comment
@ide

ide May 20, 2015

Collaborator

@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?

Collaborator

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?

@rogergl

This comment has been minimized.

Show comment
Hide comment
@rogergl

rogergl 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))]);
    };

rogergl 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

This comment has been minimized.

Show comment
Hide comment
@ide

ide May 20, 2015

Collaborator

@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.

Collaborator

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.

@rogergl

This comment has been minimized.

Show comment
Hide comment
@rogergl

rogergl 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))]);
    }; 

rogergl 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

This comment has been minimized.

Show comment
Hide comment
@sahrens

sahrens May 20, 2015

Contributor

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

Contributor

sahrens commented May 20, 2015

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

@ide

This comment has been minimized.

Show comment
Hide comment
@ide

ide May 20, 2015

Collaborator

@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.

Collaborator

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.

@kittens

This comment has been minimized.

Show comment
Hide comment
@kittens

kittens May 20, 2015

Member

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

Member

kittens commented May 20, 2015

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

@amasad

This comment has been minimized.

Show comment
Hide comment
@amasad

amasad May 20, 2015

Contributor

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.

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

@amasad amasad added the packager label May 20, 2015

@rogergl

This comment has been minimized.

Show comment
Hide comment
@rogergl

rogergl May 21, 2015

Good to know that babel is coming

rogergl commented May 21, 2015

Good to know that babel is coming

@ide

This comment has been minimized.

Show comment
Hide comment
@ide

ide May 28, 2015

Collaborator

Babel landed in master: tadeuzagallo@56d6ee3

Collaborator

ide commented May 28, 2015

Babel landed in master: tadeuzagallo@56d6ee3

@ide ide closed this May 28, 2015

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.