coolsoftwaretyler / mst-middlewares

Prebuilt middlewares for MobX-State-Tree
5 stars 2 forks source link

error when upgrading mobx-state-tree to v6 #22

Open barbalex opened 2 weeks ago

barbalex commented 2 weeks ago

When I upgrade mobx-state-tree from 5.4.2 to 6.0.0 I get this error:

[mobx-state-tree] Failed to find the environment of UndoManager@/history /history
Screenshot 2024-08-30 170615

The error is caused here: https://github.com/barbalex/awel-personal-vite/blob/master/src/store/index.js#L816

The app worked without error before upgrading. And works again fine when downgrading mobx-state-tree to v5.4.2

coolsoftwaretyler commented 2 weeks ago

HI @barbalex - thanks for the bug report! This makes sense to me. Version 6 of MobX-State-Tree included a few breaking changes, including new behaviors for getEnv, which now throws an error to be more consistent with other parts of the API. That's my guess at the culprit, but I have not investigated fully.

We did not upgrade this middlewares package alongside MobX-State-Tree because it's no longer part of the core project. But this seems like a pretty straightforward fix (I think we'll just need to try/catch around whatever getEnv calls exist in the middlewares).

If you're interested in putting together a PR to fix it, I'd be happy to prioritize reviewing it. Otherwise, I will add this to my list, but the middlewares package is low on priorities, so I can't guarantee a quick turnaround on that one. Apologies for the inconvenience in the meantime!