Skip to content

Commit e917cd9

Browse files
committed
Merge remote-tracking branch 'origin/main' into davezuch/datetime-components
2 parents d042ed4 + 1ebca50 commit e917cd9

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/DatePicker.purs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ embeddedHandleQuery = case _ of
276276
SetDisabled disabled a -> Just a <$ do
277277
H.modify_ _ { disabled = disabled }
278278
SetSelection selection a -> Just a <$ do
279-
setSelection selection
279+
setSelectionWithoutRaising selection
280280

281281
embeddedInitialize :: Maybe EmbeddedAction
282282
embeddedInitialize = Just Initialize
@@ -492,10 +492,14 @@ renderSelect y m visibility calendarItems =
492492

493493
setSelection :: forall m. MonadAff m => Maybe Date -> CompositeComponentM m Unit
494494
setSelection selection = do
495+
setSelectionWithoutRaising selection
496+
H.raise $ SelectionChanged selection
497+
498+
setSelectionWithoutRaising :: forall m. MonadAff m => Maybe Date -> CompositeComponentM m Unit
499+
setSelectionWithoutRaising selection = do
495500
st <- H.get
496501
let targetDate = maybe st.targetDate (\d -> (year d) /\ (month d)) selection
497502
H.modify_ _ { selection = selection, targetDate = targetDate }
498-
H.raise $ SelectionChanged selection
499503
synchronize
500504

501505
spec :: forall m. MonadAff m => Spec m

src/TimePicker.purs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ embeddedHandleQuery = case _ of
181181
SetDisabled disabled a -> Just a <$ do
182182
H.modify_ _ { disabled = disabled }
183183
SetSelection selection a -> Just a <$ do
184-
setSelection selection
184+
setSelectionWithoutRaising selection
185185

186186
embeddedInput :: State -> CompositeInput
187187
embeddedInput { selection, timeUnits, disabled } =
@@ -335,8 +335,12 @@ renderSelect visibility timeUnits =
335335

336336
setSelection :: forall m. Maybe Time -> CompositeComponentM m Unit
337337
setSelection selection = do
338-
H.modify_ _ { selection = selection }
338+
setSelectionWithoutRaising selection
339339
H.raise $ SelectionChanged selection
340+
341+
setSelectionWithoutRaising :: forall m. Maybe Time -> CompositeComponentM m Unit
342+
setSelectionWithoutRaising selection = do
343+
H.modify_ _ { selection = selection }
340344
synchronize
341345

342346
spec :: forall m. MonadAff m => Spec m
@@ -354,4 +358,4 @@ synchronize = do
354358
H.modify_ _ { timeUnits = generateTimes selection }
355359
case selection of
356360
Nothing -> pure unit
357-
Just time -> H.modify_ _ { search = ODT.formatTime time }
361+
Just time -> H.modify_ _ { search = ODT.formatTime time }

0 commit comments

Comments
 (0)