diff --git a/src/Components/DatePicker/Component.purs b/src/Components/DatePicker/Component.purs index 311759b6..2a3bebbf 100644 --- a/src/Components/DatePicker/Component.purs +++ b/src/Components/DatePicker/Component.purs @@ -235,10 +235,14 @@ synchronize = do setSelection :: forall m. MonadAff m => Maybe Date -> CompositeComponentM m Unit setSelection selection = do + setSelectionWithoutRaising selection + H.raise $ SelectionChanged selection + +setSelectionWithoutRaising :: forall m. MonadAff m => Maybe Date -> CompositeComponentM m Unit +setSelectionWithoutRaising selection = do st <- H.get let targetDate = maybe st.targetDate (\d -> (year d) /\ (month d)) selection H.modify_ _ { selection = selection, targetDate = targetDate } - H.raise $ SelectionChanged selection synchronize -------------------------- @@ -318,7 +322,7 @@ embeddedHandleQuery = case _ of SetDisabled disabled a -> Just a <$ do H.modify_ _ { disabled = disabled } SetSelection selection a -> Just a <$ do - setSelection selection + setSelectionWithoutRaising selection --------------------------- -- Embedded > handleMessage diff --git a/src/Components/TimePicker/Component.purs b/src/Components/TimePicker/Component.purs index 79389e08..519293bd 100644 --- a/src/Components/TimePicker/Component.purs +++ b/src/Components/TimePicker/Component.purs @@ -234,7 +234,7 @@ embeddedHandleQuery = case _ of H.modify_ _ { disabled = disabled } SetSelection selection a -> Just a <$ do - setSelection selection + setSelectionWithoutRaising selection embeddedRender :: forall m. CompositeComponentRender m embeddedRender s = @@ -351,6 +351,10 @@ synchronize = do setSelection :: forall m. Maybe Time -> CompositeComponentM m Unit setSelection selection = do - H.modify_ _ { selection = selection } + setSelectionWithoutRaising selection H.raise $ SelectionChanged selection + +setSelectionWithoutRaising :: forall m. Maybe Time -> CompositeComponentM m Unit +setSelectionWithoutRaising selection = do + H.modify_ _ { selection = selection } synchronize