@paciolan/remote-component
Advanced tools
Comparing version 2.8.0 to 2.8.1
@@ -39,4 +39,8 @@ "use strict"; | ||
(0, _react.useEffect)(function () { | ||
var update = setState; | ||
update({ | ||
loading: true | ||
}); | ||
loadRemoteModule(url).then(function (module) { | ||
return setState({ | ||
return update({ | ||
loading: false, | ||
@@ -46,3 +50,3 @@ component: module.default | ||
}).catch(function (err) { | ||
return setState({ | ||
return update({ | ||
loading: false, | ||
@@ -52,2 +56,6 @@ err: err | ||
}); | ||
return function () { | ||
// invalidate update function for stale closures | ||
update = function update() {}; | ||
}; | ||
}, [url]); | ||
@@ -54,0 +62,0 @@ return [loading, err, component]; |
{ | ||
"name": "@paciolan/remote-component", | ||
"version": "2.8.0", | ||
"version": "2.8.1", | ||
"description": "Dynamically load a React Component from a URL", | ||
@@ -33,11 +33,11 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.11.5", | ||
"@babel/core": "^7.11.5", | ||
"@babel/cli": "^7.11.6", | ||
"@babel/core": "^7.11.6", | ||
"@babel/preset-env": "^7.11.5", | ||
"@babel/preset-react": "^7.10.4", | ||
"@commitlint/cli": "^9.1.2", | ||
"@commitlint/config-conventional": "^9.1.2", | ||
"@paciolan/browserslist-config-paciolan-recommended": "^1.0.2", | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@paciolan/eslint-config-react": "^1.0.4", | ||
"@types/jest": "^26.0.13", | ||
"@testing-library/react-hooks": "^3.4.1", | ||
"@types/jest": "^26.0.14", | ||
"babel-eslint": "^10.1.0", | ||
@@ -48,3 +48,3 @@ "babel-plugin-transform-react-remove-prop-types": "^0.4.24", | ||
"enzyme-adapter-react-16": "^1.15.4", | ||
"eslint": "^7.8.1", | ||
"eslint": "^7.9.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
@@ -55,5 +55,5 @@ "eslint-plugin-babel": "^5.3.1", | ||
"git-cz": "^4.7.1", | ||
"husky": "^4.2.5", | ||
"husky": "^4.3.0", | ||
"jest": "^26.4.2", | ||
"prettier": "^2.1.1", | ||
"prettier": "^2.1.2", | ||
"react": "^16.13.1", | ||
@@ -60,0 +60,0 @@ "react-dom": "^16.13.1", |
Sorry, the diff of this file is not supported yet
42245
625