react-async-ssr
Advanced tools
Comparing version 0.4.5 to 0.4.6
# Changelog | ||
## 0.4.6 | ||
Other: | ||
* Update `react-dom` dependency | ||
* Update linting rules | ||
* Fix ESLint errors [refactor] | ||
## 0.4.5 | ||
@@ -4,0 +12,0 @@ |
@@ -30,2 +30,3 @@ /* -------------------- | ||
let resolved = false; | ||
// eslint-disable-next-line no-return-assign | ||
const resolve = () => resolved = true; | ||
@@ -32,0 +33,0 @@ promise.then(resolve, resolve); |
@@ -47,5 +47,5 @@ /* -------------------- | ||
const parentSuspense = this.suspenseNode; | ||
node.suspendedAbove = parentSuspense ? | ||
parentSuspense.suspended || parentSuspense.suspendedAbove : | ||
false; | ||
node.suspendedAbove = parentSuspense | ||
? parentSuspense.suspended || parentSuspense.suspendedAbove | ||
: false; | ||
node.containsLazy = false; | ||
@@ -68,4 +68,4 @@ this.suspenseNode = node; | ||
throw new Error( | ||
'A React component suspended while rendering, but no fallback UI was specified.\n\n' + | ||
'Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.' | ||
'A React component suspended while rendering, but no fallback UI was specified.\n\n' | ||
+ 'Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.' | ||
); | ||
@@ -106,3 +106,6 @@ } | ||
// Handle no SSR promise | ||
if (promise[NO_SSR]) return this.handleNoSsrPromise(promise); | ||
if (promise[NO_SSR]) { | ||
this.handleNoSsrPromise(promise); | ||
return; | ||
} | ||
@@ -121,3 +124,3 @@ // Follow promise | ||
}, | ||
err => { | ||
(err) => { | ||
// Handle synchronous callback - throw error | ||
@@ -220,3 +223,3 @@ if (!node) { | ||
// Abort all promises within Suspense and trigger fallbacks of nested Suspenses | ||
for (let child of suspenseNode.children) { | ||
for (const child of suspenseNode.children) { | ||
this.suspendDescendents(child); | ||
@@ -236,2 +239,3 @@ } | ||
suspendDescendents(node) { | ||
// eslint-disable-next-line no-shadow | ||
walkTree(node, (node, inLazy) => { | ||
@@ -238,0 +242,0 @@ const {type} = node; |
@@ -39,6 +39,9 @@ /* -------------------- | ||
// to handle if a falsy value has been thrown | ||
if (out === undefined) return reject(err); | ||
resolve(out); | ||
if (out === undefined) { | ||
reject(err); | ||
} else { | ||
resolve(out); | ||
} | ||
}); | ||
}); | ||
} |
@@ -142,3 +142,3 @@ /* -------------------- | ||
fallback = suspenseNode.fallback; | ||
this.convertNodeToFallback(suspenseNode); | ||
convertNodeToFallback(suspenseNode); | ||
@@ -155,9 +155,2 @@ // Stop when found a fallback that requires rendering | ||
convertNodeToFallback(node) { | ||
node.type = TYPE_FALLBACK; | ||
node.fallback = null; | ||
node.suspendedChildren = node.children; | ||
node.children = []; | ||
} | ||
/** | ||
@@ -189,3 +182,3 @@ * Render element in tree. | ||
// Restore contexts from new Context API | ||
for (let ctx of stackState.contexts) { | ||
for (const ctx of stackState.contexts) { | ||
this.pushProvider( | ||
@@ -246,3 +239,3 @@ isDev ? ctx.provider : {type: {_context: ctx.context}, props: {value: ctx.value}} | ||
// Abort all promises | ||
walkTree(this.tree, node => { | ||
walkTree(this.tree, (node) => { // eslint-disable-line consistent-return | ||
const {type} = node; | ||
@@ -397,3 +390,3 @@ if (type === TYPE_SUSPENSE) { | ||
// Convert node to fallback | ||
this.convertNodeToFallback(node); | ||
convertNodeToFallback(node); | ||
node.stackState = null; | ||
@@ -433,2 +426,9 @@ | ||
function convertNodeToFallback(node) { | ||
node.type = TYPE_FALLBACK; | ||
node.fallback = null; | ||
node.suspendedChildren = node.children; | ||
node.children = []; | ||
} | ||
// Add shim, handle and node methods | ||
@@ -435,0 +435,0 @@ Object.assign(Renderer.prototype, shimMethods, handleMethods, nodeMethods); |
@@ -82,2 +82,3 @@ /* -------------------- | ||
shimmedComponent = function(props, context, updater) { | ||
// eslint-disable-next-line no-invalid-this | ||
return render(Component, this, props, context, updater); | ||
@@ -84,0 +85,0 @@ }; |
@@ -55,3 +55,3 @@ /* -------------------- | ||
// Iterate over suspended children to call `[ON_MOUNT]()` callbacks on promises. | ||
for (let child of node.suspendedChildren) { | ||
for (const child of node.suspendedChildren) { | ||
this.process(child, true); | ||
@@ -61,3 +61,3 @@ } | ||
for (let child of node.children) { | ||
for (const child of node.children) { | ||
this.process(child, suspended); | ||
@@ -64,0 +64,0 @@ } |
@@ -29,3 +29,3 @@ /* -------------------- | ||
for (let child of children) { | ||
for (const child of children) { | ||
walkTree(child, fn, state); | ||
@@ -32,0 +32,0 @@ } |
{ | ||
"name": "react-async-ssr", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"description": "Render React Suspense on server", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"react-dom": "^16.8.4" | ||
"react-dom": "^16.8.6" | ||
}, | ||
@@ -24,18 +24,22 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "^7.2.2", | ||
"@babel/preset-env": "^7.2.3", | ||
"@babel/core": "^7.4.3", | ||
"@babel/preset-env": "^7.4.3", | ||
"@babel/preset-react": "^7.0.0", | ||
"@overlookmotel/eslint-config": "^1.1.0", | ||
"@overlookmotel/eslint-config-jest": "^1.0.0", | ||
"@overlookmotel/eslint-config-react": "^1.0.0", | ||
"@overlookmotel/eslint-config": "^2.0.0", | ||
"@overlookmotel/eslint-config-jest": "^1.0.2", | ||
"@overlookmotel/eslint-config-react": "^2.0.0", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-jest": "^23.6.0", | ||
"coveralls": "^3.0.2", | ||
"coveralls": "^3.0.3", | ||
"cross-env": "^5.2.0", | ||
"eslint": "^5.12.1", | ||
"eslint-plugin-eslint-comments": "^3.0.1", | ||
"eslint-plugin-jest": "^22.1.3", | ||
"eslint": "^5.16.0", | ||
"eslint-config-airbnb": "^17.1.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-eslint-comments": "^3.1.1", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jest": "^22.4.1", | ||
"eslint-plugin-jsx-a11y": "^6.2.1", | ||
"eslint-plugin-react": "^7.12.4", | ||
"jest": "^23.6.0", | ||
"prop-types": "^15.6.2", | ||
"prop-types": "^15.7.2", | ||
"react": "^16.6.0" | ||
@@ -42,0 +46,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48072
990
21
Updatedreact-dom@^16.8.6