react-async-ssr
Advanced tools
Comparing version 0.7.1 to 0.7.2
# Changelog | ||
## 0.7.2 | ||
No code: | ||
* Fix comment typo | ||
Tests: | ||
* Import module by name [refactor] | ||
Dev: | ||
* Update dev dependencies | ||
* Run tests on CI on Node v14 | ||
* Replace `.npmignore` with `files` list in `package.json` | ||
* `.editorconfig` config | ||
* Simplify Jest config | ||
Docs: | ||
* Fix whitespace in README [fix] | ||
## 0.7.1 | ||
@@ -4,0 +26,0 @@ |
@@ -349,3 +349,3 @@ /* -------------------- | ||
* Shim of `this.stack.pop()`. Shim is applied in class constructor. | ||
* Used to detect when existing a Suspense or Promise node in the tree. | ||
* Used to detect when exiting a Suspense or Promise node in the tree. | ||
* If exiting a Suspense node which has been suspended, fallback is | ||
@@ -352,0 +352,0 @@ * rendered. |
{ | ||
"name": "react-async-ssr", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Render React Suspense on server", | ||
"main": "index.js", | ||
"files": [ | ||
"symbols.js", | ||
"lib/**/*.js" | ||
], | ||
"author": { | ||
@@ -28,3 +32,3 @@ "name": "Overlook Motel" | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "^7.9.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"@babel/preset-react": "^7.9.4", | ||
@@ -36,5 +40,5 @@ "@overlookmotel/eslint-config": "^7.1.2", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^25.2.6", | ||
"babel-jest": "^25.4.0", | ||
"cheerio": "^1.0.0-rc.3", | ||
"coveralls": "^3.0.11", | ||
"coveralls": "^3.0.13", | ||
"cross-env": "^7.0.2", | ||
@@ -52,3 +56,3 @@ "eslint": "^6.8.0", | ||
"fs-extra": "^9.0.0", | ||
"jest": "^25.2.7", | ||
"jest": "^25.4.0", | ||
"jest-each-object": "^1.0.0", | ||
@@ -55,0 +59,0 @@ "jsdom": "^16.2.2", |
@@ -258,18 +258,18 @@ [![NPM version](https://img.shields.io/npm/v/react-async-ssr.svg)](https://www.npmjs.com/package/react-async-ssr) | ||
function Pokemon( { id } ) { | ||
const store = useContext( PokemonDataContext ); | ||
let entry = store[id]; | ||
if ( !entry ) entry = store[id] = {}; | ||
const store = useContext( PokemonDataContext ); | ||
let entry = store[id]; | ||
if ( !entry ) entry = store[id] = {}; | ||
const { data } = entry; | ||
if ( data ) return <div>My name is: { data.name }</div>; | ||
const { data } = entry; | ||
if ( data ) return <div>My name is: { data.name }</div>; | ||
let { promise } = entry; | ||
if ( !promise ) { | ||
promise = fetch(`https://pokeapi.co/api/v2/pokemon/${id}`) | ||
.then( res => res.json() ) | ||
.then( data => { | ||
entry.data = data; | ||
entry.promise = undefined; | ||
} ); | ||
entry.promise = promise; | ||
if ( !promise ) { | ||
promise = fetch(`https://pokeapi.co/api/v2/pokemon/${id}`) | ||
.then( res => res.json() ) | ||
.then( data => { | ||
entry.data = data; | ||
entry.promise = undefined; | ||
} ); | ||
entry.promise = promise; | ||
} | ||
@@ -282,4 +282,4 @@ | ||
return ( | ||
<div> | ||
<PokemonDataContext.Provider value={{}}> | ||
<div> | ||
<PokemonDataContext.Provider value={{}}> | ||
<Suspense fallback={ <div>Loading...</div> }> | ||
@@ -289,4 +289,4 @@ <Pokemon id={1} /> | ||
<Pokemon id={3} /> | ||
</Suspense> | ||
</PokemonDataContext.Provider> | ||
</Suspense> | ||
</PokemonDataContext.Provider> | ||
</div> | ||
@@ -293,0 +293,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
52086