awai-react
Advanced tools
Comparing version 0.0.1-alpha-1 to 0.0.1-alpha-2
@@ -12,3 +12,3 @@ 'use strict'; | ||
const [state, setState] = react.useState(readable.get); | ||
if (awai.isReadableAsyncState(readable) && state === void 0) { | ||
if (awai.isReadableAsyncState(readable) && readable.get() === void 0) { | ||
throw new Promise((resolve) => readable.events.changed.then(resolve)); | ||
@@ -18,7 +18,8 @@ } | ||
let mounted = true; | ||
setState(readable.get()); | ||
(async () => { | ||
while (mounted) { | ||
await readable.events.changed; | ||
const newValue = await readable.events.changed; | ||
if (mounted) { | ||
setState(readable.get()); | ||
setState(newValue); | ||
} | ||
@@ -25,0 +26,0 @@ } |
{ | ||
"name": "awai-react", | ||
"version": "0.0.1-alpha-1", | ||
"version": "0.0.1-alpha-2", | ||
"author": "Yuriy Yakym", | ||
@@ -15,3 +15,5 @@ "description": "React hooks for Awai integration", | ||
"scripts": { | ||
"build": "rm -rf dist && rollup -c rollup.config.js" | ||
"build": "rm -rf dist && rollup -c rollup.config.js", | ||
"test": "jest", | ||
"test:watch": "jest --watch" | ||
}, | ||
@@ -35,4 +37,8 @@ "repository": { | ||
"devDependencies": { | ||
"@testing-library/react": "^14.0.0", | ||
"@types/jest": "^29.5.3", | ||
"@types/react": "^18.2.16", | ||
"awai": "^0.0.1-alpha-3", | ||
"jest": "^29.6.2", | ||
"jest-environment-jsdom": "^29.6.2", | ||
"react": "^18.2.0", | ||
@@ -42,2 +48,3 @@ "rollup": "^3.26.3", | ||
"rollup-plugin-esbuild": "^5.0.0", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.1.6" | ||
@@ -44,0 +51,0 @@ }, |
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
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
10585
78
12