Skip to content

Commit 1ebca50

Browse files
authored
Merge pull request #172 from citizennet/FBCM-4170/do-not-raise-from-query
FBCM-4170 Don't raise from a query
2 parents a8c41c0 + c966916 commit 1ebca50

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/Components/DatePicker/Component.purs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,14 @@ synchronize = do
235235

236236
setSelection :: forall m. MonadAff m => Maybe Date -> CompositeComponentM m Unit
237237
setSelection selection = do
238+
setSelectionWithoutRaising selection
239+
H.raise $ SelectionChanged selection
240+
241+
setSelectionWithoutRaising :: forall m. MonadAff m => Maybe Date -> CompositeComponentM m Unit
242+
setSelectionWithoutRaising selection = do
238243
st <- H.get
239244
let targetDate = maybe st.targetDate (\d -> (year d) /\ (month d)) selection
240245
H.modify_ _ { selection = selection, targetDate = targetDate }
241-
H.raise $ SelectionChanged selection
242246
synchronize
243247

244248
--------------------------
@@ -318,7 +322,7 @@ embeddedHandleQuery = case _ of
318322
SetDisabled disabled a -> Just a <$ do
319323
H.modify_ _ { disabled = disabled }
320324
SetSelection selection a -> Just a <$ do
321-
setSelection selection
325+
setSelectionWithoutRaising selection
322326

323327
---------------------------
324328
-- Embedded > handleMessage

src/Components/TimePicker/Component.purs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ embeddedHandleQuery = case _ of
234234
H.modify_ _ { disabled = disabled }
235235

236236
SetSelection selection a -> Just a <$ do
237-
setSelection selection
237+
setSelectionWithoutRaising selection
238238

239239
embeddedRender :: forall m. CompositeComponentRender m
240240
embeddedRender s =
@@ -351,6 +351,10 @@ synchronize = do
351351

352352
setSelection :: forall m. Maybe Time -> CompositeComponentM m Unit
353353
setSelection selection = do
354-
H.modify_ _ { selection = selection }
354+
setSelectionWithoutRaising selection
355355
H.raise $ SelectionChanged selection
356+
357+
setSelectionWithoutRaising :: forall m. Maybe Time -> CompositeComponentM m Unit
358+
setSelectionWithoutRaising selection = do
359+
H.modify_ _ { selection = selection }
356360
synchronize

0 commit comments

Comments
 (0)