awai-react
Advanced tools
Comparing version 0.0.1-alpha-5 to 0.0.1-alpha-6
@@ -10,8 +10,18 @@ 'use strict'; | ||
let mounted = true; | ||
let abortController; | ||
setState(readable.getAsync()); | ||
(async () => { | ||
while (mounted) { | ||
await readable.events.changed; | ||
if (mounted) { | ||
setState(readable.getAsync()); | ||
abortController = new AbortController(); | ||
try { | ||
await Promise.any([ | ||
readable.events.fulfilled.abortable(abortController), | ||
readable.events.rejected.abortable(abortController), | ||
readable.events.requested.abortable(abortController) | ||
]); | ||
if (mounted) { | ||
setState(readable.getAsync()); | ||
} | ||
} finally { | ||
abortController.abort(); | ||
} | ||
@@ -22,2 +32,3 @@ } | ||
mounted = false; | ||
abortController?.abort(); | ||
}; | ||
@@ -24,0 +35,0 @@ }, [readable]); |
{ | ||
"name": "awai-react", | ||
"version": "0.0.1-alpha-5", | ||
"version": "v0.0.1-alpha-6", | ||
"author": "Yuriy Yakym", | ||
@@ -39,3 +39,3 @@ "description": "React hooks for Awai integration", | ||
"@types/react": "^18.2.16", | ||
"awai": "^0.0.1-alpha-3", | ||
"awai": "^1.0.0-alpha-2", | ||
"jest": "^29.6.2", | ||
@@ -42,0 +42,0 @@ "jest-environment-jsdom": "^29.6.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
17090
140
1