Skip to content
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

Update react-is to 16.6 #6447

Merged
merged 2 commits into from Nov 21, 2018
Merged

Update react-is to 16.6 #6447

merged 2 commits into from Nov 21, 2018

Conversation

frehner
Copy link
Contributor

@frehner frehner commented Nov 1, 2018

A followup to #6420 and #6417 , the version of React-is that was installed didn't allow lazy to actually pass validation -- it doesn't recognize it yet, since lazy was added in 16.6.

I was going to add a test for it, but that also requires updating the package's react and react-dom to 16.6 so I can import React, {lazy, Suspense} from 'react'. However, when I tried that update, other tests in other areas failed that I'm not that familiar with.

If you want me to look into that, I can. I'm just not familiar with those areas. :)

@frehner frehner changed the title Update react is Update react-is to 16.6 Nov 1, 2018
@timdorr
Copy link
Member

timdorr commented Nov 1, 2018

This only affects our local testing, which doesn't use any of the newer APIs from 16.6.

Note that npm doesn't ship package-lock.json files. The version string provided in the package.json's dependency list is used to resolve the version obtained when installing the package. ^16.5.2 is loose enough to support anything up to version 17, including the 16.6.0 you're after.

This should be enforced by react/react-dom being at version 16.6.0, but the npm module resolution algorithm can be weird with conflicting dep versions. Is this something you're running into with beta.6?

@frehner
Copy link
Contributor Author

frehner commented Nov 1, 2018

Sorry, I'm confused -- react-is is in dependencies and not devDependencies, so whatever is in the package-lock.json is ultimately what's bundled with react-router, right?

The reason for this PR is because I'm using a lazy component, and with beta.6 it's still giving me a prop-type warning:
screen shot 2018-11-01 at 2 48 17 pm

However, I could be misunderstanding what you're saying?

@pshrmn
Copy link
Contributor

pshrmn commented Nov 1, 2018

The package lock is only used for installing the actual react-router repo (git clone https://github.com/ReactTraining/react-router.git && npm install).

If you npm install react-router, you are installing a release and the dependencies from the package.json are installed.

If you remove your node_modules and re-install, the latest react-is should be installed.

@frehner
Copy link
Contributor Author

frehner commented Nov 1, 2018

Ah, maybe yarn handles this differently then. This is what happens with a clean start with yarn in a project that is using beta.6:
screen shot 2018-11-01 at 3 28 21 pm
(screenshot is of yarn.lock file)

Note that react-is is still only at 16.5.2

[edit] hm, actually, I did a completely clean start with only adding react-router and react-router-dom in an empty directory/project, and it did install 16.6. So I'm missing something then :)

@frehner frehner closed this Nov 1, 2018
@frehner
Copy link
Contributor Author

frehner commented Nov 1, 2018

Turns out that the project was using enzyme-adapter-react-16@^1.6.0 which, at the time, had installed react-is@16.5.2

Because beta.6's version also matched that, it didn't install the newer 16.6 version of react-is, and thus used the older one that doesn't include lazy components.

So this PR would solve the issue in cases where projects already have a version of react-is@16.5.2. But if you feel that that's unnecessary, then I'll just leave it closed.

@frehner
Copy link
Contributor Author

frehner commented Nov 2, 2018

I'm still unsure that this should be closed -- if your project has react-is@16.5.2 already installed through another dependency, you're not going to get react-is@16.6 and your prop types are going to fail for lazy components.

@frehner frehner reopened this Nov 2, 2018
@mjackson
Copy link
Member

mjackson commented Nov 2, 2018

We can't update our React dep to version 16 w/out bumping our major version. I will note that I am currently planning on making version 5 dependent on React 16.7+, but that is still in alpha.

In the meantime, maybe it makes sense to ditch react-is for now and relax the propType to PropTypes.any with a note that says "let's upgrade this in v5". What do you think @frehner?

@frehner
Copy link
Contributor Author

frehner commented Nov 2, 2018

I believe we can upgrade ‘react-is’ independently of ‘react’, though I’m not 100% sure.

The only reason I mentioned upgrading react was because I wanted to add a test but can’t until it is upgraded :(

If react-is can’t be updated independently, then yeah I can make the change to something more relaxed.

(Sorry for formatting, on mobile)

@mjackson
Copy link
Member

mjackson commented Nov 3, 2018

Just checked react-is 16.6 and there is no dependency on react, so I think that should work.

@frehner
Copy link
Contributor Author

frehner commented Nov 19, 2018

Is there anything preventing this from being merged that I can help with?

As seen in both #6420 and #6471 people are getting confused because the beta isn't updating react-is to the latest version. I'm just trying to help reduce the amount of confusion and comments :)

@timdorr
Copy link
Member

timdorr commented Nov 19, 2018

I'm cool with it if @mjackson is cool with it.

@mjackson mjackson merged commit 0cec74f into remix-run:master Nov 21, 2018
@mjackson
Copy link
Member

Thanks, @frehner!

@frehner frehner deleted the update-react-is branch November 26, 2018 17:54
@lock lock bot locked as resolved and limited conversation to collaborators Jan 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants