@t8/react-pending 1.0.31 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# T8 React Pending
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Self-contained async action state management for React apps
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@t8/react-pending) 
|
|
5
|
+
[](https://www.npmjs.com/package/@t8/react-pending) 
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Features:** Decoupled from app state management and async actions' internals · Local or shared async action state · CSR/SSR-compatible
|
|
8
8
|
|
|
9
9
|
<!-- docsgen-show-start --
|
|
10
10
|
```diff
|
|
@@ -60,11 +60,11 @@ In our setup, there are two components rendering their content with regard to th
|
|
|
60
60
|
export let Status = () => {
|
|
61
61
|
+ let [state] = usePendingState("fetch-items");
|
|
62
62
|
|
|
63
|
-
if (!state.initialized) return
|
|
64
|
-
if (!state.complete) return
|
|
65
|
-
if (state.error) return
|
|
63
|
+
if (!state.initialized) return null;
|
|
64
|
+
if (!state.complete) return <>Busy</>;
|
|
65
|
+
if (state.error) return <>Error</>;
|
|
66
66
|
|
|
67
|
-
return
|
|
67
|
+
return <>OK</>;
|
|
68
68
|
};
|
|
69
69
|
```
|
|
70
70
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t8/react-pending",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.33",
|
|
4
|
+
"description": "Self-contained async action state management for React apps",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"demo": "npx @t8/serve
|
|
10
|
+
"demo": "npx @t8/serve tests/async_status --spa -b src/index.tsx",
|
|
11
11
|
"preversion": "npx npm-run-all shape test",
|
|
12
12
|
"shape": "npx codeshape",
|
|
13
13
|
"test": "npx playwright test --project=chromium"
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"keywords": [
|
|
23
23
|
"async actions",
|
|
24
24
|
"pending state",
|
|
25
|
+
"async state",
|
|
25
26
|
"react"
|
|
26
27
|
],
|
|
27
28
|
"peerDependencies": {
|
|
@@ -29,13 +30,13 @@
|
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@playwright/test": "^1.56.0",
|
|
32
|
-
"@t8/serve": "^0.
|
|
33
|
+
"@t8/serve": "^0.2.0",
|
|
33
34
|
"@types/node": "^24.10.2",
|
|
34
35
|
"@types/react": "^19.2.7",
|
|
35
36
|
"@types/react-dom": "^19.2.3",
|
|
36
37
|
"react-dom": "^19.2.3"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@t8/react-store": "^1.2.
|
|
40
|
+
"@t8/react-store": "^1.2.8"
|
|
40
41
|
}
|
|
41
42
|
}
|