This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (29)
- # aws (2)
- # beginners (25)
- # boot (110)
- # business (15)
- # cider (39)
- # cljs-dev (3)
- # clojure (90)
- # clojure-czech (28)
- # clojure-hamburg (1)
- # clojure-japan (24)
- # clojure-poland (149)
- # clojure-russia (46)
- # clojure-sg (9)
- # clojure-uk (6)
- # clojure-ukraine (1)
- # clojurescript (105)
- # core-async (37)
- # cursive (9)
- # dato (7)
- # datomic (6)
- # emacs (10)
- # events (1)
- # hoplon (22)
- # jobs (4)
- # ldnclj (38)
- # leiningen (4)
- # off-topic (17)
- # om (173)
- # onyx (134)
- # re-frame (46)
- # reagent (35)
(ns ^:figwheel-always x.core (:require [re-com.core :refer [v-box label title p gap]] [re-com.util :refer [get-element-by-id]] [reagent.core :as reagent])) (defn main  [gap :size "1em"]) (defn ^:export mount-ui  (reagent/render [main] (get-element-by-id "app"))) (mount-ui) ---- I get this exception when I try to run that code: Uncaught TypeError: Cannot read property 'call' of undefined. Any ideas what can cause it? If I use [p "text here"] it works, and any normal functions that I define ala reagent works
@mbertheau: do you mean something more than inspecting @re-frame.db/app-db in the repl ?
When you are waiting for an AJAX request, how do you show the user that progress is happening?
quantisan: what about forms? the form is submitted and I’m waiting for the reply that might me OK or validation errors.
It’s part design, part coding. I’m also interested in how to keep track of waiting for something without having to do it explicitly every time. Some useful pattern.
Wow… I just prototyped a solution for forms and it took 3 lines of code: https://github.com/carouselapps/ninjatools/commit/af91527f0634bb12f1ce8874314667dfa914663f
@mbertheau: Here is a useful debugging tip I picked up from @escherize ...
When you are debugging a reagent view ... and particularly the value coming through in a cursor or subscription (re-frame) or props ...
... add something like this to the hiccup in your view ...
[:pre (with-out-str (pprint @some-ratom))] ;; assuming that @some-ratom is the value you want to observe
You don't even have to use
pprint, you could just do this:
[:pre (pr-str @some-ratom)]
If you do use the
pprint version then you'll need to require it in at the top of your view.cljs:
[cljs.pprint :refer [pprint]]
Further note: the advanced version of this technique is to not use
pprint but instead to use @yogthos' excellent json-html library: https://github.com/yogthos/json-html for an even more carefully arranged display.
I'm not sure if it's a great idea, but I add the json-html'd table to the bottom of the top level form, in a div with a class that has display:none.
btw, @mikethompson I've been using recom (and learning flexbox) more lately, it's by far the better way to build html.
@escherize: excellent. I actually think that the layout side of re-com is probably the most useful and reusable part of the whole thing
flexbox is still pretty terrible (compared to other non-browser technologies I've used) BUT it is still waaaaaaay better than the rest of the HTML layout tech available
@escherize: just to state the obvious ... be really sure to read the docs supplied: http://re-demo.s3-website-ap-southeast-2.amazonaws.com/#/layout
There's some hard-fought-for knowledge in those docs. A lot of the flexbox tutorials drown you in detail. But the key thing to understand when nesting them, is the
flex attribute (aka
:size in re-com). It always resolves to a triple of values (GSB).
BTW, we have been working on a "grid" component for
re-com. Virtual vertical scrolling (ie. can handle 100K rows). Row headers, Col headers. Scrollbars etc
@mikethompson: do you think it's still too early to use flexbox for modern web apps development?
ivanbokii: flexbox has pretty good support across the board now for, as you say, modern development http://caniuse.com/#search=flexbox
@gjnoonan: yep, checked that, but a bit afraid about firefox problems listed here https://github.com/Day8/re-com#warning-re-com-might-not-be-for-you-just-yet
yeah, I need to look up lazy sequence and understand better, I'm new to clojure (relatively)
IIRC reagent tracks invalidation with reading a mutable var referring to the currently rendered component; I imagine if you put a deref in a lazy seq then the component might end up being different than what you expect and it will break
Basically any sequence in Clojure is lazy (unless something explicitly says in docs it's eager)
filter and so on return lazy sequences by default (there was one frequently usedseq function that is eager, but I'm not 100% sure which one so I don't want to confuse)
@mangr3n: I think you could just deref this atom here - https://github.com/Day8/re-frame/blob/master/src/re_frame/db.cljs
BTW, nevermind that request, I thought that because I wasn't seeing a value that I'd "missed" the signal from the mutation. It seems that a subscription always fires the first time.
I was failing to de-ref a value from a reaction as I moved from statically defined data to data from a subscription.
I'm building the first page into an SPA replacement of an existing J2EE, jquery/Struts/Hibernate + Backbone + handwritten JS/Java knitted castle...
@ivanbokii: regarding using flexbox now, or not, I wrote this in the the re-com README > the grinding pain and longevity of IE6 has conditioned many to expect 8, 9 and 10 to hang around forever too. But, this time around, there's quite a different dynamic. Microsoft itself is very actively forcing their demise - come Jan 12th 2016 corporates will have to be on IE11. See http://blogs.msdn.com/b/ie/archive/2014/08/07/stay-up-to-date-with-internet-explorer.aspx > So, by Q1 2016, the market share of IE9 and IE10 will have diminished sufficiently that they could be ignored. Probably. Maybe. If so, a modern flexbox implementation will be available on all the browsers you then care about. So that's surprisingly soon, but not now!