From 9f6d742f88c1ca03e450055ee9492ee3aa345f75 Mon Sep 17 00:00:00 2001 From: geekact Date: Mon, 19 Dec 2022 10:43:55 +0800 Subject: [PATCH] refactor: remove optional chain syntax --- src/middleware/modelInterceptor.ts | 2 +- src/store/modelStore.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/middleware/modelInterceptor.ts b/src/middleware/modelInterceptor.ts index 74d7d15..55aa0f9 100644 --- a/src/middleware/modelInterceptor.ts +++ b/src/middleware/modelInterceptor.ts @@ -14,7 +14,7 @@ export const modelInterceptor: Middleware<{}, Record> = return action.consumer(draft, action); }); - action.actionInActionGuard?.(); + action.actionInActionGuard && action.actionInActionGuard(); if (deepEqual(prev, next)) return action; diff --git a/src/store/modelStore.ts b/src/store/modelStore.ts index 9b1c200..71fbabe 100644 --- a/src/store/modelStore.ts +++ b/src/store/modelStore.ts @@ -132,11 +132,11 @@ export class ModelStore> extends StoreBasic { onInitialized(maybeSync?: () => void): Promise { return new Promise((resolve) => { if (this._isReady) { - maybeSync?.(); + maybeSync && maybeSync(); resolve(); } else { this.topic.subscribeOnce('ready', () => { - maybeSync?.(); + maybeSync && maybeSync(); resolve(); }); }