-
Notifications
You must be signed in to change notification settings - Fork 47.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
warn when it looks like you haven't updated react-dom #14572
warn when it looks like you haven't updated react-dom #14572
Conversation
I should add a flag that fires this warning only once. |
How did you test this? It's likely specific message in #14039 is no longer what happens. We need to actually look at what happens when e.g. using It's also worth looking at what happens when you mix Could you write up an analysis of what different combinations fail with today? |
I haven't tested this, setting it up right now. will report back. |
This isn't the first issue to arise from mismatched react/react-dom versions, and it probably won't be the last. Could we just add a We already have |
We kind of wanted |
Why not? Using mismatched versions isn't something people do intentionally (afaik) and if a user is already updating one, the burden of updating the other should be low. |
If it works fine, what's the point of being too sensitive about it? In general it doesn't cause issues anymore. |
alright, I've verified, here's how react/react-dom at various versions interact with a simple hook -
honestly, this is kind of an edgecase squared, mismatched versions of react/react-dom and using hooks recently. maybe we shouldn't do anything. |
It does cause issues though, and even if it causes less issues now there is still a chance that it will break things in the future. I don’t think there’s any reason to think that this would be less likely in the future? We don’t have any fixtures looking for undefined behavior with mismatched versions before release AFAIK A single warning doesn’t seem too sensitive either. There’s no case where we recommend using mismatched versions, so it would always signal a real issue to the user. |
@threepointone It "throws" on usage only, right? If we don't use Hooks then it's ok? |
throws what?
which invariant? |
@gaearon - they all throw - "Hooks can only be called inside the body of a function component.". 0.0 - 2.0 throw it as a regular error (like, codesandbox reported it as a normal error), the rest as an invariant (with the 'invariant' warning). |
OK. I think the most actionable thing here is to make a doc page (similar to "current owner" error) that explains possible causes (calling outside render, calling inside useMemo, duplicate React, wrong version of React), and add a link to the existing invariant. What do you think? |
Yeah, I think that would gather these loose ends in one place. I'll do it. |
closing |
sketching a possible "fix" for #14039 for discussion.