mobxjs / mobx

Simple, scalable state management.
http://mobx.js.org
MIT License
27.51k stars 1.77k forks source link

mobx from 3.1.12 to 3.1.16 stops work as expected #1066

Closed vyemialyanchyk closed 7 years ago

vyemialyanchyk commented 7 years ago

Welcome to MobX. Please provide as much relevant information as possible!

I have a:

  1. [x] Issue:
    • [x] Provide error messages including stacktrace no error messages in browser, primary browser is Chrome in IE 11 the same problem
    • [x] Provide a minimal sample reproduction. create a reproduction based on this codesandbox I've attached screenshot from my TortoiseWorkbench, only updated files in not workable configuration
    • [x] Did you check this issue wasn't filed before? the issue is reproducible starting from 3.1.12, i.e. I've checked all versions 3.1.12, 3.1.13, 3.1.14, 3.1.15, 3.1.16 delete package-lock.json and node_modules folder, then npm install npm run ...
    • [x] Elaborate on your issue. What behavior did you expect? I expect MobX workable as in versions 3.1.10 and 3.1.11
    • [x] State the versions of MobX and relevant libraries. Which browser / node / ... version? all such infor presented here

I've did renew libraries dependances for my frontend project which use React, MobX, TypeScript, Webpack. I updated react from 15.5.4 to 15.6.1 and mobx from 3.1.10 to 3.1.16 My project start to work incorrectly. I.e. it display initial page and that is it. Even login input field stops work. I spent 2 days to locate the reason. The reason is mobx version update. mobx 3.1.11 is workable. mobx from 3.1.12 to 3.1.16 not workable releases. 3.1.12-3.1.13 I can't even build/run my application.

I've attached screenshot which prove the reason is only mobx not other libs dependences.

mobix-3 1 12-3 1 16-bug-locate

Knacktus commented 7 years ago

Same here. I haven't checked all previous versions but can confirm that 3.1.11 works whereas 3.1.16 doesn't seem to trigger updates. I'm using MobX with React integration. State can be changed but no updates occur.

@vyemialyanchyk: Thanks, you've saved me a lot of time!

andykog commented 7 years ago

@vyemialyanchyk have you tried to update mobx-react package as well? Could you share npm ls depth=1 output? Doesn't mobx.extras.shareGlobalState() help, by any chance? May be related to #1027

vyemialyanchyk commented 7 years ago

I used "mobx-react": "4.2.1", which is latest version. In my project it was updated 4 weeks ago from version 4.1.8, i.e. mobx-react is not a reason, I think. I provided screenshot with exact files in project, which were updated, and mobx stoped work...

npm ls depth=1
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "depth=1": Tags may not have any characters that encodeURIComponent encodes.

Doesn't mobx.extras.shareGlobalState() help, by any chance? May be related to #1027

checking...

vyemialyanchyk commented 7 years ago

@Knacktus yes exactly the same problem,

I'm using MobX with React integration. State can be changed but no updates occur.

vyemialyanchyk commented 7 years ago

@andykog this is snippet from configuration:

package.json

...
        "babel-core": "6.24.1",
        "babel-eslint": "7.2.3",
        "babel-loader": "7.0.0",
        "babel-plugin-transform-class-properties": "6.24.1",
-----       "babel-plugin-transform-decorators-legacy2": "1.3.5", -- removed
        "babel-preset-es2015": "6.24.1",
        "babel-preset-react": "6.24.1",
        "babel-runtime": "6.23.0",
        "babili-webpack-plugin": "0.1.1",
        "mobx-react-devtools": "4.2.13",
        "webpack": "2.6.1",
        "webpack-bundle-analyzer": "2.8.2",
        "webpack-dev-server": "2.4.5"
...

.babelrc:

    "presets": [
        "react",
        "es2015"
    ],
    "plugins": [
-----       "transform-decorators-legacy2", -- removed
        "transform-class-properties"
    ]
vyemialyanchyk commented 7 years ago

@andykog mobx.extras.shareGlobalState() is something what after mobX 3.0.0 per this doc from google: http://admin.mysocialreach.net/ng2/node_modules/angular2-tree-component/node_modules/mobx/CHANGELOG.md

I used practically all latest versions of libs, 1 month ago all was updated. MobX 3.1.10 and 3.1.11 works as expected. So do not see a sense with mobx.extras.shareGlobalState().

I had classes with properties marked as @observable & @computed in file1.tsx for example and React component with @observer in file2.tsx for example. This was working in 3.1.10 and working in 3.1.11.

mweststrate commented 7 years ago

What is the difference between "babel-plugin-transform-decorators-legacy2" and ""babel-plugin-transform-decorators-legacy"? Can someone produce a minimal reproduction project?

vyemialyanchyk commented 7 years ago

@mweststrate please disregard transform-decorators-legacy2 I've removed this from the config, now this have no sense for the project, this was a legacy old setting. The problem with 3.1.16 persist.

mweststrate commented 7 years ago

Note that you still need transform-decorators-legacy. Would you mind creating a small reproduction repo? I upgraded a babel / webpack project to the same versions but couldn't reproduce the problem

Op vr 30 jun. 2017 om 09:01 schreef vyemialyanchyk <notifications@github.com

:

@mweststrate https://github.com/mweststrate please disregard transform-decorators-legacy2 I've removed this from the config, now this have no sense for the project, this was a legacy old setting. The problem with 3.1.16 persist.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx/issues/1066#issuecomment-312191472, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvGhNlEtY7hnTxgCwGc6_17mykdYCSyks5sJJ0sgaJpZM4OGhgl .

vyemialyanchyk commented 7 years ago

That working without transform-decorators-legacy and transform-decorators-legacy2.. @mweststrate , can you share your small test project example, so I'll try to update it, so get problem reproducible?

andykog commented 7 years ago

@vyemialyanchyk, https://github.com/mobxjs/mobx-react-todomvc

vyemialyanchyk commented 7 years ago

one, first glance difference: in my case all files with .ts and .tsx extensions...

vyemialyanchyk commented 7 years ago

@andykog also, from the second glance: in the example project I do not see import { action } from 'mobx/lib/mobx'; action use

mweststrate commented 7 years ago

You should not be importing from mobx/lib, but always from 'mobx`. Probably you are using some VS code extension that produces the wrong imports...

Op vr 30 jun. 2017 om 16:29 schreef vyemialyanchyk <notifications@github.com

:

@andykog https://github.com/andykog also, from the second glance: in the example project I do not see import { action } from 'mobx/lib/mobx';action use

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx/issues/1066#issuecomment-312282336, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvGhCCsNF-sCiCmRlwAhkLvH0M8q2d4ks5sJQZIgaJpZM4OGhgl .

mweststrate commented 7 years ago

Resulting in MobX being bundled twice?

Op vr 30 jun. 2017 om 16:33 schreef Michel Weststrate <mweststrate@gmail.com

:

You should not be importing from mobx/lib, but always from 'mobx`. Probably you are using some VS code extension that produces the wrong imports...

Op vr 30 jun. 2017 om 16:29 schreef vyemialyanchyk < notifications@github.com>:

@andykog https://github.com/andykog also, from the second glance: in the example project I do not see import { action } from 'mobx/lib/mobx';action use

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx/issues/1066#issuecomment-312282336, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvGhCCsNF-sCiCmRlwAhkLvH0M8q2d4ks5sJQZIgaJpZM4OGhgl .

andykog commented 7 years ago

Thats why a asked @vyemialyanchyk to try mobx.extras.shareGlobalState()

mweststrate commented 7 years ago

check!

vyemialyanchyk commented 7 years ago

great! thank you. import { ... } from 'mobx/lib/mobx'; replace to import { ... } from 'mobx'; and mobx 3.1.16 workable.

mweststrate commented 7 years ago

Version 3.2 will warn about this in the future (if all mobx versions are on 3.2+)