This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-22
Channels
- # beginners (24)
- # boot (80)
- # braid-chat (11)
- # cider (89)
- # clara (11)
- # cljsfiddle (5)
- # cljsjs (9)
- # cljsrn (63)
- # clojure (114)
- # clojure-austin (1)
- # clojure-berlin (5)
- # clojure-brasil (4)
- # clojure-dusseldorf (5)
- # clojure-hamburg (17)
- # clojure-india (1)
- # clojure-new-zealand (3)
- # clojure-poland (1)
- # clojure-russia (91)
- # clojure-taiwan (1)
- # clojure-uk (54)
- # clojurebridge (3)
- # clojurescript (170)
- # core-matrix (1)
- # cursive (14)
- # datomic (8)
- # emacs (13)
- # hoplon (96)
- # immutant (20)
- # jobs (9)
- # jobs-rus (13)
- # kosmos (3)
- # off-topic (8)
- # om (111)
- # onyx (41)
- # parinfer (116)
- # pedestal (2)
- # proton (4)
- # re-frame (46)
- # reagent (7)
- # ring-swagger (24)
- # slack-help (2)
- # testing (1)
- # untangled (8)
@levitanong: yay for starting the defelem
docs, I’m going to add a little bit to it as well, including micha’s example from the forum post I linked in the github issue
i’m just going to add some more introductory information too
like “what is an element?” and “what should I return?"
@levitanong: I've encountered the first problem with switch-tpl
- doesn't play well when placed inside loop-tpl
: merge-kids
https://github.com/hoplon/hoplon/blob/master/src/hoplon/core.cljs#L82 wants to append an element which has to be a DOMElement, while it's really a Cell
now thinking - why does this happen if Hoplon seems to be overriding the appendChild
function on the Element prototype
@dm3: Is the switch-tpl
inside a div?
switch-tpl
is a bit like loop-tpl
. it needs a “real” elem to bind in
(div
(loop-tpl :bindings [a as]
(div
(switch-tpl …))))
as for why, it should be in the hoplon docs. lemme check.
https://github.com/hoplon/hoplon/wiki/Raw-material#loop-tpl-cannot-be-a-child-of-a-custom-component
afaik, you cannot nest a loop-tpl inside a loop-tpl without placing a div in between
it doesn’t actually say why, but i think @micha explained it to me long ago, and I just forgot 😛
https://github.com/hoplon/hoplon/wiki/Raw-material#loop-tpl-cannot-be-a-child-of-a-custom-component
@levitanong: i expanded on your defelem docs at https://github.com/hoplon/hoplon/wiki/API-Documentation
@dm3 Your interpretation looks correct though, in the sense that the problem seems to lie in the fact that it returns a cell instead of an element. But I fail to see a way by which we can work around this, because then we’d have to wonder how nesting a cell in a cell would work 😛
@thedavidmeister: hurrah! thanks man
Oh wow, you were really thorough here! this is great 😄
@levitanong: i just took what you and micha had written previously, then added all the things i learned from the chat room
> I'm guessing you had usecases in Adzerk where you had to generate DOM conditionally, e.g. different forms based on some condition type. How did you handle that, given that (cell= (cond a (form-a) b (form-b)))
is not recommended due to potentially generated garbage.
whenever we end up there we always end up refactoring it to something simpler and it goes away
where you start to get into that territiroy is like a tree view of a directory structure
(recall looking at the project, awesome! the amount of code you wrote and the abstractions)
the cond-tpl macro that's going to be merged seems like it would be ideal for that use case
if there is no need to do anything else then i'll just leave it like that, it seems simplest to me that way
the usual way to attack it is to try to transform the problem into a linearization problem
in my experinece i've found that if i can express the problem in a way that can be approached with loop-tpl then everything will fall into place