You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible now to do an async call to initialize a component? I have something like this, where I want an image loaded on startup and a button to reload it:
imageLoader = withAsync $ with \st h ->let
setUrl u = updatePure h $ case u ofJust a -> st # imgUrl .~ Success a
Nothing-> st # imgUrl .~ Failed unit
reload = update h $ do
async (JS.decode <<< _.response <$> (AJ.get someUrl)) (const Nothing)
pure st
in withView (H.div $ [ H.onInitialized "foo" $ const reload ]) $ mconcat
[ imgUrl $ mconcat
[ _Failed $ ui $ H.p_ $ text "error"
, _Success $ with \s _ -> ui $ H.div_ $ H.img [ H.srcA $ extractUrl s ] mempty
]
, ui $ H.button [ H.onClick $ const reload ] $ text "reload"
, listen (const true) setUrl
]
But it doesn't seem to fire. Maybe it's possible to hook it up via the _Init prism somehow?
The text was updated successfully, but these errors were encountered:
Oh, in theory this should work; probably there is something wrong with how initializers are attached to the vdom. I'll have a look at it as soon as possible.
Is it possible now to do an async call to initialize a component? I have something like this, where I want an image loaded on startup and a button to reload it:
But it doesn't seem to fire. Maybe it's possible to hook it up via the
_Init
prism somehow?The text was updated successfully, but these errors were encountered: