-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HasPostGui Equivalent in Reflex-Dom 0.4? #139
Comments
@mageshb there is reflex-frp/reflex#75 (unfortunately with no particular answer yet) |
@qrilka Thank you, I'm able to make it work with those api changes |
@ryantrinkle is there some new way to do that?
but I need some way to get |
it's definitely similar, though in your example code I think there's a misunderstanding - the spans won't exist until the button is pressed. You could use the support from #152 inside the widgetHold to wait until those spans are mounted (after the button is pressed) and it shouild report 2 at that time. |
@Dridus that's not a misunderstanding - that's the requirement :) |
After adding some delay code was working OK on a small page but in our app we load substantial amount of data so e.g. delay of 100ms isn't enough :( |
well, I think what you want is possible, but not as described, though it could be I'm misunderstanding what your requirement is. If the goal is to be notified from the origination of some event (i.e. the button press) that all consequential UI updates are complete, then that's not possible with the #152 code. However, if you don't mind observing this from the end point then you can do it, for example: elWithChildren
:: MonadWidget t m
=> Event t [Text] -> m ()
elWithChildren ev = do
mountState <- fmap join . el "div" $
widgetHold (text "Waiting" $> constDyn Mounting) $
ffor ev $ \xs -> forM_ xs $ \x -> el "span" $ text x
_ <- performEventAsync $ (\_ -> liftIO js_logSpans) <$ ffilter (== Mounted) mountState i.e. within the widgetHold you can ask for a Dynamic representing when that chunk of DOM has been mounted. |
@Dridus thanks. |
oh, yes, didn't compile it of course. corrected, hopefully: elWithChildren
:: MonadWidget t m
=> Event t [Text] -> m ()
elWithChildren ev = do
mountState <- fmap join . el "div" $
widgetHold (text "Waiting" $> constDyn Mounting) $
ffor ev $ \xs -> do
forM_ xs $ \x -> el "span" $ text x
getMountStatus
_ <- performEventAsync $ (\_ -> liftIO js_logSpans) <$ ffilter (== Mounted) mountState |
and it's kinda #110. #110 comes up because of two cases (both overcome by #152):
#152 gives a notification mechanism which keeps track of the parent mount state as well as the local one, and the local mount state is bumped to Mounted when the DOM fragment goes in (after all children become ready). those two states are zipped together with |
I'm trying to upgrade few of our libraries to make it compatible to latest reflex & reflex-dom.
I couldn't able to find the equivalent of HasPostGui in the latest version.
https://github.com/byteally/reflex-indexed-db/blob/master/src/Reflex/IDB.hs#L83-L103
In above code which works fine with hackage version of reflex & reflex-dom,
basically I'm able to use
askPostGui
,runWithActions
to convert native indexed-db events to Reflex events.How to get this functionality with the latest version?
I could see lot of changes between the latest version and the one in the hackage.
Is the latest reflex-dom is stable enough so that we can start porting the code to it or should we need to stick to the version available in the hackage for now?
Is there any idea when we can expect to see a next hackage release?
The text was updated successfully, but these errors were encountered: