-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #129 * Change getDerivedStateFromProps to componentDidUpdate * Change getDerivedStateFromProps to componentDidUpdate * HMR now works * All errors fixed. All tests run successfull. Before polishing. * Polish * Moving chunk name resolution back to slashes * new 4v branch * merges and bumping version * adding codeowners * usesBabelPlugin added back * feat: Updated RUC to react 16.3 and up Moving away from deprecated willMount and to the non-deprecated lifecycle BREAKING CHANGE: Only Compatible with React 16.3 and up * fix: ignore babel rename by default * flow types * updated yarn locks
- Loading branch information
1 parent
3eeaa58
commit 3c21ffa
Showing
7 changed files
with
2,308 additions
and
917 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# babel-plugin-universal-import maintainers | ||
* @ScriptedAlchemy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
*.log | ||
.idea | ||
.DS_Store | ||
.history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"name": "react-universal-component", | ||
"version": "0.0.0-development", | ||
"version": "4.0.0-alpha.4", | ||
"description": "A higher order component for loading components with promises", | ||
"main": "dist/index.js", | ||
"typings": "index.d.ts", | ||
"author": "James FaceySpacey Gillmore <[email protected]> (http://www.faceyspacey.com)", | ||
"contributors": [ | ||
"Zack Jackson <zackary.l.jackson@gmail.com> (https://github.com/ScriptedAlchemy)" | ||
"Zack Jackson <zack@ScriptedAlchemy.com> (https://github.com/ScriptedAlchemy)" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
|
@@ -65,15 +65,15 @@ | |
"jest": "^20.0.4", | ||
"lint-staged": "^7.2.0", | ||
"prettier": "^1.3.1", | ||
"react": "^16.4.1", | ||
"react-test-renderer": "^16.4.1", | ||
"react": "^16.4.2", | ||
"react-test-renderer": "^16.4.2", | ||
"rimraf": "^2.5.4", | ||
"semantic-release": "^6.3.6", | ||
"slash": "^1.0.0", | ||
"travis-github-status": "^1.6.3" | ||
}, | ||
"peerDependencies": { | ||
"react": "*" | ||
"react": "^16.3.0" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
|
@@ -93,6 +93,7 @@ | |
}, | ||
"dependencies": { | ||
"hoist-non-react-statics": "^2.2.1", | ||
"prop-types": "^15.5.10" | ||
"prop-types": "^15.5.10", | ||
"react-hot-loader": "^4.3.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import hoist from 'hoist-non-react-statics' | ||
import UniversalComponent from './index' | ||
|
||
export const __update = ( | ||
props, | ||
state, | ||
isInitialized, | ||
isMount = false, | ||
isSync = false, | ||
isServer = false | ||
) => { | ||
if (!isInitialized) return state | ||
if (!state.error) { | ||
state.error = null | ||
} | ||
return __handleAfter(props, state, isMount, isSync, isServer) | ||
} | ||
|
||
/* eslint class-methods-use-this: ["error", { "exceptMethods": ["__handleAfter"] }] */ | ||
export const __handleAfter = (props, state, isMount, isSync, isServer) => { | ||
const { mod, error } = state | ||
|
||
if (mod && !error) { | ||
hoist(UniversalComponent, mod, { | ||
preload: true, | ||
preloadWeak: true | ||
}) | ||
|
||
if (props.onAfter) { | ||
const { onAfter } = props | ||
const info = { isMount, isSync, isServer } | ||
onAfter(info, mod) | ||
} | ||
} | ||
else if (error && props.onError) { | ||
props.onError(error) | ||
} | ||
|
||
return state | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.