-
Notifications
You must be signed in to change notification settings - Fork 1
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
Lists of children can only be the last child of an element #2
Comments
I’ll look into this later. But it could be also an issue in Hicada compiler which Prum adopted recently. If you could try to compile the snippet with Hicada directly and report back it would help to identify the source of the issue. Thanks. |
Oh wait. I just noticed that you have Hiccup inside of map fn. Most likely it is not being compiled. The reason is that Prum/Hicada doesn’t have runtime interpretation unlike Rum/Sablono. Hicada can walk into simple forms like if, let, do, cond, case, etc., but not into other function calls. Wrap that Hiccup form with prum.compiler/html macro to force compilation. |
Is the list of h1’s rendered as expected? |
The list is being rendered as expected, but anything after it isn't rendered. |
How about an instance where I want a dynamic number of sub-components in the middle of other elements? |
A list of components is rendered as expected, bc components use html macro internally. |
Could you test now directly with Hicada? |
Apparently this:
Results in this:
However, a for works perfectly:
Using map for components works, however it eliminates anything following it:
This does though:
What's very strange is what this results in:
Results in:
|
I'm looking into Hicada now. I'm not entirely understanding how it works though. |
Looks like things are messed up here. I’ll take a look closer next week. Don’t worry. Thanks for helping me out with this! |
Thanks! Let me know if there's anything I can do to help. |
OK. So...
Now that I know where to look at, I'll dig into Preact and see what can be done there. |
Looks like it has something to do with ClojureScript's collections, not entirely sure yet. But, for example, Preact renders fine Immutable.js persistent collections. For now the workaround is to use (prum/defc Layout [_]
[:div
[:h1 "alpha"]
(->> (map #(Number %) (range 5)) into-array)
[:h1 "beta"]]) |
In Rum, I could have:
However, in Prum, "beta" doesn't show up. Everything works as expected if the map list is moved to the bottom.
The text was updated successfully, but these errors were encountered: