In my halogen project have this eval branch:
eval (SetTest tName next) = do
H.set (State Nothing)
detail <- H.fromAff $ toAff settings $ getTestsByTestname (tName ^. unTestName)
H.set (State (Just detail))
pure next
The toAff bit if off doing AJAX and may take a while to return. In my render function I have
, case ts of
Nothing ->
HH.div [class_ BS.centerBlock]
[HH.i [classes (HH.className <$> ["fa", "fa-spinner", "fa-spin", "loading"])]
[]
]
Just td ->
HH.h3_ [HH.text $ td ^. tdName<<<unTestName]
I'm naively expecting to see a loading spinner when until my aff action returns, but it looks like the eval runs all the way through before the html is rendered. Is this correct?
edit
Turns out this was user error - I was calling my Query in wrong order. Future mes: setting the state does indeed update the ui :-)