This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-13
Channels
- # admin-announcements (6)
- # beginners (19)
- # boot (1)
- # cbus (2)
- # cider (3)
- # clara (24)
- # cljs-dev (4)
- # cljsrn (18)
- # clojure (168)
- # clojure-boston (1)
- # clojure-dev (55)
- # clojure-russia (199)
- # clojure-sg (2)
- # clojurescript (38)
- # clojurex (1)
- # core-async (15)
- # css (16)
- # cursive (62)
- # datomic (23)
- # editors-rus (17)
- # events (3)
- # funcool (1)
- # hoplon (360)
- # ldnclj (37)
- # lein-figwheel (11)
- # leiningen (1)
- # nginx (1)
- # off-topic (13)
- # om (361)
- # onyx (1)
- # re-frame (56)
- # reagent (24)
- # robots (1)
- # spacemacs (46)
- # yada (9)
@richiardiandrea: I think this should answer your issue: https://github.com/Day8/re-com/issues/76#issuecomment-156278411
@gregg yes I was reading and yes it should ! 😄
I’m doing this: my init cljs function has this signature (defn ^:export init [] …)
it loads it when I re-load the page, but when I make changes to the cljs files, it doesn’t. I can see it recompiles it, but it won’t load the changes on the dom.
@roberto: do you have the following?
:cljsbuild {:builds [{:id "dev"
:source-paths ["src/cljs" "test/cljs"]
:figwheel {:on-jsload "launcher.test/run"}
try it out 😄
hmmm, I get a weird exception Uncaught Error: Invariant Violation: _registerComponent(...): Target container is not a DOM element.
are you getting the an existing DOM element with reagent/render
?
(sorry for the silly question)
(defn mount-root []
(reagent/render [current-page] (.getElementById js/document "app")))
(defn ^:export init []
(.log js/console "IN init!")
(routes/app-routes)
(mount-root))
(defn on-reload []
(.log js/console "The DOM EL: " (.getElementById js/document "app"))
(.log js/console "CURRENT PAGE: " current-page)
(init))
weird, I have had that error only when I did not have any app
in my index.html
np 😉
(defn outreach-list []
(let [ls (subscribe [:outreach-list])]
(fn []
(.log js/console "OUTREACH : " (clj->js @ls))
[:div.row {:style {:margin-left "0.1em"}}
[:div.row>div.bootcards-list>div.panel.panel-default>div.list-group
[:div.list-group-item>h4.list-group-item-heading "Outreach List"]
(for [outreach @ls]
(let [id (:_id outreach)
date (:date outreach)]
^{:key id} [:a.list-group-item {:href "#"}
[:h4.list-group-item.heading date]
[:p.list-group-item-text
[:div>span "Hey"]]]))]])))
(defn app []
(fn []
(.log js/console "IN App...")
[:div.row.container-fluid {:style {:margin-left "0.5em"}}
[:div.container.col-md-10
[outreach-list]]]))
(defn main-panel []
(fn []
(.log js/console "IN main panel ")
[:div
[navbar]
[app]]))
So I’m thinking that app
can’t render because main-panel
is being re-rendered, or something like that
mmm no that shoud work, I have never had any problem with it
in app and main-panel you are using a form-2
render with no state, you might as well just return the hiccup
but it should not change much
it looks like you are losing some DOM element for some reason the second time
according to my experience, this happens when there is some rendering initial error but your code looks ok
I call it
like this:
<script>
window.prstr = function (obj) { return cljs.core.pr_str(obj) };
window.onload = function () { cljs_browser_repl.core.main(); }
</script>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<!-- Bootcards CSS for desktop: -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootcards/1.0.0/css/bootcards-desktop.min.css">
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<!-- Bootstrap and Bootcards JS -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootcards/1.0.0/js/bootcards.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<title>PASMO Outreach</title>
</head>
<body>
<div id="app">
</div>
<script src="/js/app.js" type="text/javascript"></script>
<script>
window.onload = function () { pasmo_outreach.ui.core.init(); }
</script>
</body>
</html>
body yep
well again, very weird, it looks good
ah, yeah, it is weird. For some very strange reason, it can’t find the dom element. But if I don’t use onload
, it does find it.
what if you comment out (routes/app-routes)
?
if I comment that, then I do get the dom element, but now I get a different error. It complains that the hiccup form is in valid. I’ll change it back to Form 2
yeah these is the biggest pain atm, debugging 😄
so, I didn’t use onload
and my on-reload
function only calls mount-root
instead of the entire init
funciton
great!
Sorry again if I ask here, but is there a way to align (pushing based on the widest) the first column in a re-columb h-box?
I mean align the red boxes to INTEROP here
dynamically
Only if you explicitly set their width
or min-width
or something
There is nothing "linking" their widths currently
yep, I even thought of doing it dynamically, but it is too convoluted, thanks @mikethompson
dynamically meaning taking the width from the component life cycle methot component-did-mount