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

Latest version (v0.14.0) breaks react-native #375

Open
nol13 opened this issue Jun 4, 2019 · 2 comments
Open

Latest version (v0.14.0) breaks react-native #375

nol13 opened this issue Jun 4, 2019 · 2 comments

Comments

@nol13
Copy link

nol13 commented Jun 4, 2019

After react-native upgrade to 0.59.8, @babel/plugin-transform-regenerator requires downgrade to v7.4.4 (which used v0.13.4) or you will get 'ready-only' errors. (seemed to happen with things connected in mapDispatchToProps in our case.)

"Possible Unhandled Promise Rejection (id: 0): Error: “[some function]” is read-only"

See https://stackoverflow.com/questions/56340427/possible-unhandled-promise-rejection-id-0-error-getlogindata-is-read-only

@nol13 nol13 changed the title Latest version breaks react-native Latest version (v0.14.0) breaks react-native Jun 4, 2019
@timmywil
Copy link

timmywil commented Jun 8, 2019

Took me a while to track down the right package. Looks like it is regenerator. For me, it happens whenever I use a redux dispatch pattern in an async function. For example,

import { setLoading } from '../actions/loading'
import { connect } from 'react-redux'
...
class TestComponent {
  someMethod = async () => {
    // Shadowed variable, but no assignment
    const { setLoading } = this.props
    // expected (v0.13.4): setLoading = _this.props.setLoading;
    // actual (v0.14.0): _loading.setLoading = (_this.props.setLoading, function () {
    //    throw new Error('"' + "setLoading" + '" is read-only.');
    // }());
  }
}
...
connect(null, { setLoading })(TestComponent)

Workaround:

"resolutions": {
    "regenerator-transform": "0.13.4"
}

From my very limited understanding, this could be related to the hoisting changes in 0.14.0.

@Dsantacruz
Copy link

Dsantacruz commented Sep 2, 2019

I've a async function, when destructuring and save const show me error: Possible Unhandled Promise Rejection (id: 0): Error: “userOperations” is read-only , this worked for me (change let by const):

loadOrCreateCustomer = async () => { let { personalInformation, userOperations } = this.props; userOperations.setCardsByCustomer(cards); }

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

3 participants