reflex-dom
reflex-dom copied to clipboard
Collection widget content gets deleted on page load completion with ghcjs
Not quite sure whether this is an obelisk problem instead, but this code:
dynText (pure "zero")
void $ simpleList (pure ["one"]) (dyn_ . fmap text)
void $ listWithKey (pure (() =: "two")) (const (el "p" . dynText))
renders the three strings while loading, then "one" and "two" disappear. This only happens when cross-compiling; with jsaddle, the behaviour is as expected.
test case project here: https://github.com/tek/reflex-bug-1
Run with jsaddle: ob run
Run with ghcjs:
cd $(nix-build -A exe)
./backend
Additional twist:
When I discovered this in a real world case, I used listWithKey
with a Map
of maybe 20 elements. In that case, it doesn't render none of the elements, but only one. It is the one that shows up as the last element of the list when printing the Dynamic t (Map ...))
with traceDyn
.
Furthermore, this only happens on page load; when navigating to a different route (Obelisk), the entire thing is rendered (In this case, the data is populated by getPostBuild
and EventWriter
, but apparently that is not necessary for the bug to appear)