1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm 2024-03-08 11:27:18 +08:00
parent 94cf96a0e5
commit e39d4fa370
No known key found for this signature in database
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "10.2.4",
"version": "10.2.5",
"description": "react-native hot update",
"main": "src/index.ts",
"scripts": {
@ -68,9 +68,9 @@
"detox": "^20.5.0",
"eslint": "^8.57.0",
"eslint-plugin-ft-flow": "^3.0.7",
"jest": "^29.7.0",
"firebase-tools": "^11.24.1",
"fs-extra": "^9.1.0",
"jest": "^29.7.0",
"pod-install": "^0.1.37",
"prettier": "^2",
"react": "18.2.0",

View File

@ -34,6 +34,7 @@ export const PushyProvider = ({
const [updateInfo, setUpdateInfo] = useState<CheckResult>();
const [progress, setProgress] = useState<ProgressData>();
const [lastError, setLastError] = useState<Error>();
const lastChecking = useRef(0);
const dismissError = useCallback(() => {
setLastError(undefined);
@ -102,6 +103,11 @@ export const PushyProvider = ({
);
const checkUpdate = useCallback(async () => {
const now = Date.now();
if (lastChecking.current && now - lastChecking.current < 1000) {
return;
}
lastChecking.current = now;
let info: CheckResult;
try {
info = await client.checkUpdate();