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(); }); }