Closed chrisdone closed 2 years ago
I achieved what I wanted via the mentioned approach:
component ::
forall query input output m n.
MonadAff m =>
+ (input -> query Unit) ->
m (NT n Aff) ->
H.Component HH.HTML query (Input query input output n) output m
-component contextualize =
+component mkQuery contextualize =
H.mkComponent
{ initialState
, render
@@ -210,7 +198,9 @@ component contextualize =
state <- H.get
for_ state.io (H.liftAff <<< _.dispose)
pure a
- H.Receive input a -> pure a
+ H.Receive input a -> do
+ _ <- eval (H.Query (liftCoyoneda (mkQuery (input.input))) identity)
+ pure a
H.Action output a -> do
H.raise output
At least, it seems to be working properly.
When I swap
H.slot
withportalAff
, the component no longer receives updates after arender
occurs.Indeed, the
H.Receive
branch doesn't do anything with receive. One approach might be to pass an argument in toportal
that would take an input and turn it into a query, but I was unable to make anything type check.