[FIXED] Invalid hook call -- react-meteor-data

This just happened right now after update and downgrading react-meteor-data didn’t seem to fix anything either. I am about to try downgrading that package again though.

So strange. Anyone else having similar issues?

This is my component where the crash occurs:

export default function Login() {
  const [loginData, setLoginData] = useState(initialLoginState);
  const currentUser = useTracker(() => Meteor.user(), []);
  const history = useHistory();
  const notifications = useNotifications();

  //... rest of component
}

I have useTracker in a few places, but basically anywhere I am using it - it’s crashing now.

Don’t think I have mismatching versions of React, I am sure I am not breaking the rules of hooks. I don’t have more than one version of React either.

Ok I downgraded properly…

FYI

meteor remove react-meteor-data
meteor add react-meteor-data@2.3.1

Still added react-meteor-data@2.3.2, although showed as @2.3.1 in my packages file.
I needed to update the versions file to have 2.3.1 then restart my app and it’s now fine.

Submitted an issue. Invalid hook call – react-meteor-data 2.3.2 · Issue #339 · meteor/react-packages · GitHub
Although looking at the commit nothing much changed beyond dev dependencies.

Strange 2.3.2 were just dependencies updates…

Yeah it make little sense.

Like I said, if I toggle between those two versions - I get that crash.
It is a pretty new update, lets see if anyone else runs into the same issue.

Got the error as well. :smiley:

1 Like

I have a fix, it is a publication issue. Will publish a new version shortly.

2 Likes

Oh man thank you so much.
I was scared I would be stuck debugging it further - I had no idea why it wasn’t working.