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

[preact][mobx 5.13] TypeError: Cannot read property 'get' of undefined #20

Open
gganster opened this issue Jul 31, 2019 · 0 comments
Open

Comments

@gganster
Copy link

gganster commented Jul 31, 2019

Hi,
I've this error and I don't know how to solve it:
Uncaught TypeError: Cannot read property 'get' of undefined mobx.module.js.618

var computedDecorator = createPropDecorator(false, function (instance, propertyName, descriptor, decoratorTarget, decoratorArgs) { HERE -> var get = descriptor.get, set = descriptor.set; // initialValue is the descriptor for get / set props // Optimization: faster on decorator target or instance? Assuming target // Optimization: find out if declaring on instance isn't just faster. (also makes the property descriptor simpler). But, more memory usage.. // Forcing instance now, fixes hot reloadig issues on React Native: var options = decoratorArgs[0] || {}; asObservableObject(instance).addComputedProp(instance, propertyName, __assign({ get: get, set: set, context: instance }, options)); });

I'm using preact with mobx/mobx-preact: my package.json:
{ "name": "React-in-WP", "version": "1.0.0", "license": "MIT", "main": "src/index.js", "scripts": { "dev": "cross-env BABEL_ENV=default webpack --watch", "build": "cross-env BABEL_ENV=default NODE_ENV=production webpack -p" }, "devDependencies": { "@babel/core": "^7.5.5", "@babel/preset-env": "^7.5.5", "@wordpress/babel-preset-default": "^1.2.0", "autoprefixer": "^9.6.1", "babel-core": "^6.26.3", "babel-eslint": "^8.2.3", "babel-loader": "^7.1.4", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-react-jsx": "^6.24.1", "classnames": "^2.2.6", "cross-env": "^5.1.5", "css-loader": "^3.1.0", "eslint": "^4.19.1", "extract-text-webpack-plugin": "^3.0.2", "mobx": "^5.13.0", "mobx-preact": "^3.0.0", "node-sass": "^4.9.0", "postcss-loader": "^2.1.5", "preact-places-autocomplete": "0.0.3", "preact-router": "^2.6.1", "raw-loader": "^0.5.1", "react": "^16.8.6", "sass-loader": "^6.0.7", "style-loader": "^0.19.1", "webpack": "^3.0.0", "webpack-cli": "^3.3.6" }, "dependencies": { "preact": "^8.4.2", "run-script": "^0.1.1" } }

and my babel.rc:
{ "plugins": [ ["transform-react-jsx", { "pragma": "h" }], "transform-class-properties" ] }
thanks

sorry for the indent, I don't know why github does not display my indentation. repo https://github.com/zoraneus/preact-mobx-reproduction-err

I have tried to put it in code sandbox but the error does not occur.

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

1 participant