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
If we think the action of getting content as a request, then the displayed results are the responses that arrived after the last event, whereas I expect either all or one response corresponding to the last to be displayed.
Observations
As I've shown in the example, this does not need to have atRemote to happen.
If an event happens within the render parameter, it deletes the rendering of all subsequent ones.
But when the content has not arrived, the subsequent render is non-existent, so it is not affected by this. I believe this, although documented, is what's causing the strange behavior of the example program.
The text was updated successfully, but these errors were encountered:
At this moment multithreaded display in the browser is not solved well. inputString produces a new thread when an event happens. This is allowed since it could be useful for some purposes in order to make application responsive. There are some fixes:
use threads 0 $ render . inputString...
disabling the input box and enabling it after the rendering
using at there is no duplication:
main = void . keep . initNode . onBrowser . local $ do
name <- render $ inputString Nothing `fire` OnKeyUp <++ div ! id "result"
content <- liftIO $ do
threadDelay 500000 -- simulate a delay
pure ("Hello " ++ name)
render $ at "#result" Insert $ rawHtml (p content)
Steps to reproduce
1234567890
at about 5 key strokes per secondExpected behavior
After it settles, I expect either
10 lines appearing, saying
and so on, one for each
keyup
event, orone line appearing, saying
corresponding to the last
keyup
eventActual Behavior
I only some of the corresponding lines.
If we think the action of getting
content
as a request, then the displayed results are the responses that arrived after the last event, whereas I expect either all or one response corresponding to the last to be displayed.Observations
As I've shown in the example, this does not need to have
atRemote
to happen.Replacing
liftIO
withasync
doesn't helpWhat does this have to do with
render
I believe this behavior of
render
, is causing this:But when the
content
has not arrived, the subsequentrender
is non-existent, so it is not affected by this. I believe this, although documented, is what's causing the strange behavior of the example program.The text was updated successfully, but these errors were encountered: