Skip to content

Commit 08ed676

Browse files
committed
refactor(reactant-share): refactor syncFullState
1 parent 26bde77 commit 08ed676

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ yarn start
6060

6161
---
6262

63-
Reactant is very easy to get Started.
64-
You can try Reactant by visiting the [online project](https://stackblitz.com/edit/reactant-ts).
63+
Reactant is very easy to get started. You can try Reactant by visiting the [online demo](https://stackblitz.com/edit/reactant-ts).
6564

6665
Here is the counter example:
6766

packages/reactant-share/src/portDetector.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ export class PortDetector {
250250
if (forceSync) {
251251
this.syncFullStatePromise = undefined;
252252
}
253-
if (this.syncFullStatePromise) return;
253+
if (this.syncFullStatePromise) {
254+
await this.syncFullStatePromise;
255+
return;
256+
}
254257
if (typeof this.transports.client === 'undefined') {
255258
throw new Error(`The current client transport does not exist.`);
256259
}

packages/reactant-share/src/router.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ class ReactantRouter extends BaseReactantRouter {
5252
if (!this.portDetector.sharedAppOptions.forcedSyncClient) {
5353
const visibilitychange = async () => {
5454
if (document.visibilityState === 'visible') {
55-
this.portDetector.syncFullState({ forceSync: false });
56-
await this.portDetector.syncFullStatePromise;
55+
await this.portDetector.syncFullState({ forceSync: false });
5756
if (this.toBeRouted) {
5857
const fn = this.toBeRouted;
5958
this.toBeRouted = null;

0 commit comments

Comments
 (0)