mobxjs / mobx-react

React bindings for MobX

Home Page:https://mobx.js.org/react-integration.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New version is breaking previous versions (Error: mobx-react-lite@3 requires mobx at least version 6 to be available)

kutomer opened this issue · comments

Hello,

I'm using mobx v5 (5.15.7) and mobx-react v6 (6.3.0) and noticed that your last deployment (7.0.0) those unrelated versions stoped working, this is because "mobx-react 6 / 7 is a repackage of the smaller mobx-react-lite package..." and the package.json in 6.3.0 is defined as follows: "mobx-react-lite": ">=2.2.0" which now brings mobx-react-lite v3, and throws: Error: mobx-react-lite@3 requires mobx at least version 6 to be available.

This bug unfortunately broke our production environment (deployed to QA env before the mobx-react version deployment so we couldn't catch that there)

How to reproduce? just install mobx 5.15.7 & mobx-react 6.3.0 and see :)

Edit:

For those of you suffering from the same issue, here is a temporary solution I found:
inside package-lock.json, search for:

      "version": "3.0.0",
      "resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-3.0.0.tgz",
      "integrity": "sha512-SJgrTD9mfClFOsamB+0y6zjteSMr4gkp9usnpIeEi8E+lW3lMgDa3hnD4PJgLGoENpJ8/9OmO3vrkA50SNy0mw=="

and replace with:

    "mobx-react-lite": {
      "version": "2.2.2",
      "resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-2.2.2.tgz",
      "integrity": "sha512-2SlXALHIkyUPDsV4VTKVR9DW7K3Ksh1aaIv3NrNJygTbhXe2A9GrcKHZ2ovIiOp/BXilOcTYemfHHZubP431dg=="
    },

Will very much appreciate your help in this matter.

Tomer.

We're seeing the same issue in the downstream project redoc, which generates OpenAPI/Swagger docs. Redoc is pulling in mobx-react 6.3.0 but also relies on an older version of mobx, so it is breaking as well.

Related issue: Redocly/redoc#1398

One way to fix this could be to publish a new patch version 6.3.1, with a stricter dependency on mobx-react-lite like

  "dependencies": {
    "mobx-react-lite": ">=2.2.0 <3.0.0"
  },

Thanks!

Or use mobx-react 6.2.2
use "mobx-react": "6.2.2",
instead of "mobx-react": "^6.2.2"

Yes that should have been a caret range. Will publish a fix.

But please folks, commit your lock files, otherwise transitive dependencies can always break your stuff completely at random :)

published mobx-react@6.3.1 to fix this issue.

Working, thanks :)