Skip to content

Commit cd01857

Browse files
Copilotsawka
andcommitted
Further refactor resyncController to use common helper method
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
1 parent de00662 commit cd01857

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

frontend/app/view/tsunami/tsunami.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,13 @@ class TsunamiViewModel extends WebViewModel {
7272
}, 300);
7373
}
7474

75-
resyncController() {
76-
const prtn = RpcApi.ControllerResyncCommand(TabRpcClient, {
77-
tabid: globalStore.get(atoms.staticTabId),
78-
blockid: this.blockId,
79-
forcerestart: false,
80-
});
81-
prtn.catch((e) => console.log("error controller resync", e));
82-
}
83-
84-
private doControllerResync(forceRestart: boolean, logContext: string) {
85-
if (globalStore.get(this.isRestarting)) {
86-
return;
75+
private doControllerResync(forceRestart: boolean, logContext: string, triggerRestart: boolean = true) {
76+
if (triggerRestart) {
77+
if (globalStore.get(this.isRestarting)) {
78+
return;
79+
}
80+
this.triggerRestartAtom();
8781
}
88-
this.triggerRestartAtom();
8982
const prtn = RpcApi.ControllerResyncCommand(TabRpcClient, {
9083
tabid: globalStore.get(atoms.staticTabId),
9184
blockid: this.blockId,
@@ -94,6 +87,10 @@ class TsunamiViewModel extends WebViewModel {
9487
prtn.catch((e) => console.log(`error controller resync (${logContext})`, e));
9588
}
9689

90+
resyncController() {
91+
this.doControllerResync(false, "resync", false);
92+
}
93+
9794
restartController() {
9895
this.doControllerResync(false, "restart");
9996
}

0 commit comments

Comments
 (0)