react-native-update 10.2.2 → 10.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.2.2",
3
+ "version": "10.2.4",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/src/client.tsx CHANGED
@@ -38,7 +38,7 @@ export class Pushy {
38
38
  };
39
39
 
40
40
  lastChecking: number;
41
- lastResult: CheckResult;
41
+ lastRespJson?: Promise<any>;
42
42
 
43
43
  progressHandlers: Record<string, EmitterSubscription> = {};
44
44
  downloadedHash: string;
@@ -139,11 +139,11 @@ export class Pushy {
139
139
  assertRelease();
140
140
  const now = Date.now();
141
141
  if (
142
- this.lastResult &&
142
+ this.lastRespJson &&
143
143
  this.lastChecking &&
144
144
  now - this.lastChecking < 1000 * 5
145
145
  ) {
146
- return this.lastResult;
146
+ return await this.lastRespJson;
147
147
  }
148
148
  this.lastChecking = now;
149
149
  this.report({ type: 'checking' });
@@ -184,11 +184,11 @@ export class Pushy {
184
184
  type: 'errorChecking',
185
185
  message: 'Can not connect to update server. Please check your network.',
186
186
  });
187
- return this.lastResult || empty;
187
+ return this.lastRespJson ? await this.lastRespJson : empty;
188
188
  }
189
- const result: CheckResult = await resp.json();
189
+ this.lastRespJson = resp.json();
190
190
 
191
- this.lastResult = result;
191
+ const result: CheckResult = await this.lastRespJson;
192
192
 
193
193
  if (resp.status !== 200) {
194
194
  this.report({
package/src/provider.tsx CHANGED
@@ -148,6 +148,10 @@ export const PushyProvider = ({
148
148
  const markSuccess = client.markSuccess;
149
149
 
150
150
  useEffect(() => {
151
+ if (__DEV__) {
152
+ console.info('检测到在DEV环境,不会进行热更新检查');
153
+ return;
154
+ }
151
155
  const { strategy, dismissErrorAfter, autoMarkSuccess } = options;
152
156
  if (isFirstTime && autoMarkSuccess) {
153
157
  markSuccess();