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

📦 React 15 support #2426

Merged
merged 24 commits into from
May 1, 2018
Merged

📦 React 15 support #2426

merged 24 commits into from
May 1, 2018

Conversation

giladgray
Copy link
Contributor

@giladgray giladgray commented Apr 26, 2018

Changes proposed in this pull request:

  • restore component support for React 15! arguably we should not have dropped support in the first place, as the cost is small and the upside for users is huge.
    • update core peer dependency "react" >=15.3.0 (for PureComponent)
    • Portal now degrades to ReactDOM.unstable_renderSubtreeIntoContainer if ReactDOM.createPortal is not available
    • remove one usage of fragment in Button
  • add a circle job to run all tests against React 15 (in parallel with React 16)
  • add some docs about React 15 caveats

image

@giladgray giladgray changed the title React 15 support 🔧 React 15 support Apr 26, 2018
@giladgray giladgray changed the title 🔧 React 15 support 📦 React 15 support Apr 26, 2018
@llorca
Copy link
Contributor

llorca commented Apr 26, 2018

well it's really not that bad for us to be React 15 compatible! nice stuff

@@ -45,8 +45,8 @@
"tslib": "^1.9.0"
},
"peerDependencies": {
"react": "^16.2.0",
"react-dom": "^16.0.0",
"react": ">=15.3.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth setting an upper bound here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's this or 15 || 16

@giladgray giladgray added this to the 3.0.0 milestone Apr 26, 2018
Copy link
Contributor

@themadcreator themadcreator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments and questions


export interface IPortalProps extends IProps, HTMLDivProps {
const isReact15 = typeof ReactDOM.createPortal === "undefined";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this to a more accurate name like canCreatePortal or reactApiHasCreatePortal or whatever

@@ -2,9 +2,13 @@
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*/

import "./polyfill";
require("./polyfill");
Copy link
Contributor

@themadcreator themadcreator Apr 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it necessary to switch to commonjs for this test code? shouldn't the node version that runs it support es6 modules?

Copy link
Contributor Author

@giladgray giladgray Apr 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary because isotest uses this now and that suite explicitly runs in a node environment (for server-side rendering). added code comment.

"private": true,
"dependencies": {
"enzyme-adapter-react-15": "^1.0.5",
"react": "^15.6.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since react 16 is already released, should we just pin this to the final 15.x version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there could be future patches? this is 15.6.x

@blueprint-bot
Copy link

Merge branch 'develop' of github.com:palantir/blueprint into gg/react15

Preview: documentation | landing | table

@blueprint-bot
Copy link

revert require() syntax where possible

Preview: documentation | landing | table

@blueprint-bot
Copy link

peer dependency `^15.3.0 || 16`

Preview: documentation | landing | table

@blueprint-bot
Copy link

revert to commonjs syntax with a comment

Preview: documentation | landing | table

@@ -30,4 +30,18 @@ application.
`Portal` supports the following options on its [React context](https://facebook.github.io/react/docs/context.html).
To use them, supply a child context to a subtree that contains the Portals you want to customize.

<div class="@ns-callout @ns-intent-primary @ns-icon-info-sign">
Blueprint uses the React 15-compatible `getChildContext()` API instead of the newer React 16.3 `React.createContext()` API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you want to use React.createContext() or some other new React feature in the future? Supporting both versions might seem like a few hundred LOC right now, but it could end up being pretty limiting.

Copy link
Contributor Author

@giladgray giladgray Apr 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree, it is quite limiting, but it's the quickest path to adoption.

shim/ponyfill packages are available, such as create-react-context, which is actually used in the latest version of react-popper to support multiple versions. so we could go down that route, like we did with pure-render-decorator.

@blueprint-bot
Copy link

semantic merge circle config

Preview: documentation | landing | table

@blueprint-bot
Copy link

circle cache

Preview: documentation | landing | table

@blueprint-bot
Copy link

remove console color from enzyme message

Preview: documentation | landing | table

@giladgray giladgray merged commit 9a93f09 into develop May 1, 2018
@giladgray giladgray deleted the gg/react15 branch May 1, 2018 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants