From df1f780509ae47f06c12ae9e335d60b067106bd4 Mon Sep 17 00:00:00 2001 From: Andrea Cigana <24194202+ciganandrea@users.noreply.github.com> Date: Thu, 18 Feb 2021 00:09:50 +0100 Subject: [PATCH] fix: Update middlewares only if available (#79) --- src/stateMachine.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/stateMachine.tsx b/src/stateMachine.tsx index 1ccfe7c..d821ad8 100644 --- a/src/stateMachine.tsx +++ b/src/stateMachine.tsx @@ -20,7 +20,7 @@ export function createStore( ) { options.name && (storeFactory.name = options.name); options.storageType && (storeFactory.storageType = options.storageType); - storeFactory.updateMiddleWares(options.middleWares); + options.middleWares && storeFactory.updateMiddleWares(options.middleWares); if (process.env.NODE_ENV !== 'production') { setUpDevTools( @@ -61,7 +61,10 @@ function actionTemplate( }; } -export function useStateMachine>( +export function useStateMachine< + TCallback extends AnyCallback, + TActions extends AnyActions +>( actions?: TActions, ): { actions: ActionsOutput;