I just upgraded tried to upgrade my app from 1.10.2 to 2.2.1, because I need the extended features of MongoDB 4.4.
However, after the update, the UI broke with the following error messages:
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem. at resolveDispatcher (react-meteor-data.js?hash=085e11d486d61b046c1711ec1d5bf34be9d73759:1955) at useRef (react-meteor-data.js?hash=085e11d486d61b046c1711ec1d5bf34be9d73759:1994) at useTrackerNoDeps (useTracker.ts:140) at useTrackerClient (useTracker.ts:250) at useTrackerDev (useTracker.ts:281) at withTracker.tsx:17 at renderWithHooks (modules.js?hash=bb88bc1e1a58565c5bd4a4e9d1684b0e681e496e:110281) at updateForwardRef (modules.js?hash=bb88bc1e1a58565c5bd4a4e9d1684b0e681e496e:112164) at beginWork$1 (modules.js?hash=bb88bc1e1a58565c5bd4a4e9d1684b0e681e496e:114232) at HTMLUnknownElement.callCallback (modules.js?hash=bb88bc1e1a58565c5bd4a4e9d1684b0e681e496e:94357) modules.js?hash=bb88bc1e1a58565c5bd4a4e9d1684b0e681e496e:115864 The above error occurred in the <ForwardRef> component: in ForwardRef in ForwardRef (created by Context.Consumer) in Route (created by Context.Consumer) in Switch (created by Context.Consumer) in Router (created by ConnectedRouter) in ConnectedRouter (created by Context.Consumer) in ConnectedRouterWithContext (created by Context.Consumer) in Connect(ConnectedRouterWithContext) (created by Context.Consumer) in MainRoutes (created by AppContainer) in LocaleSwitch (created by AppContainer) in LocaleProvider (created by GlobalStateProvider) in Provider (created by GlobalStateProvider) in GlobalStateProvider (created by AppContainer) in AppContainer Consider adding an error boundary to your tree to customize error handling behavior. Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
It seems to be related to forwarding refs?
Here’s the relevant React packages I’m using:
"react": "^16.11.0", "react-dom": "^16.11.0", "react-loadable": "^5.5.0", "react-redux": "^6.0.1", "react-router-dom": "^5.2.0",
react-meteor-data is at 2.1.3 (updated from 2.1.0). I am wondering why this causes trouble, as I can find no breaking changes regarding this package in the release notes. If I try to downgrade it to 2.1.0, Meteor reverts my change. Why did Meteor update this package in the first place?!