This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-10
Channels
- # aleph (4)
- # announcements (27)
- # aws (12)
- # aws-lambda (1)
- # beginners (207)
- # boot (4)
- # calva (8)
- # cider (9)
- # clj-kondo (9)
- # cljs-dev (27)
- # cljsrn (6)
- # clojure (104)
- # clojure-android (3)
- # clojure-dev (9)
- # clojure-finland (2)
- # clojure-italy (18)
- # clojure-spec (8)
- # clojure-uk (100)
- # clojurescript (43)
- # clojutre (1)
- # core-async (49)
- # cursive (18)
- # data-science (3)
- # duct (24)
- # events (2)
- # fulcro (27)
- # immutant (1)
- # off-topic (32)
- # om (2)
- # onyx (2)
- # pathom (14)
- # pedestal (2)
- # planck (3)
- # re-frame (38)
- # reagent (7)
- # reitit (10)
- # rewrite-clj (7)
- # ring-swagger (3)
- # shadow-cljs (32)
- # spacemacs (63)
- # test-check (16)
- # tools-deps (5)
- # vim (21)
@souenzzo You can require: [com.fulcrologic.fulcro.algorithms.tempid :as tmp], then use (tmp/tempid)
.
In the source of tempid.clj there are two defn tempid
, one in a clj
block, and the other in a cljs
block. By 'block' I mean #?(:clj: ...)
or #?(:cljs: ...)
form.
hi, anyone know how to provide a custom root for a workspaces fulcro-card
? I want to have all my components wrapped by my theme provider.
Something about fulcro3 introduces a lot of trace, example: 16:51:18.237 [Datomic Metrics Reporter] DEBUG datomic.process-monitor - {:event :metrics/report, :phase :begin, :pid 29804, :tid 48}
. How to change the trace level?
See the lein template on F2 for deps you can include to make sure everything gets sent to timbre, then you can do a timber/set-level!
or blacklist certain nses.
In project.clj (this project uses just lein) I changed to [org.clojure/clojure "1.10.0"]
(was [org.clojure/clojure "1.9.0"]
), and all the trace went away.
Changing Clojure version may not have been it. I do get this excessive trace problem when use [org.immutant/web "2.1.10"]
, but not when use [http-kit "2.3.0"]
.
So, I want some feedback about a particular issue, esp from long-time users (@currentoor @wilkerlucio @mitchelkuijpers etc.). The defsc
macro in 2.x tried to close over this
and props
where it made sense in the things it directly supported (e.g. ident
, componentDidMount
, etc) so you can write:
(defsc Comp [this {:keys [some-id]}]
{:ident [:table some-id]
:componentDidMount (fn [] ...this...)})
which was a bit of a mash-up. It eliminated a lot of redundant destructuring, but it made the lifecycle methods a bit confusing because none of them take the real props
(but some get prior or next props). The use of a lambda notation implied they were lambdas, but in fact they are just syntactic notation (`fn` in 2.x can be any symbol in those).
In Fulcro 3 I want to keep the special support for ident/query/initial-state, but I’m considering dropping the auto-inclusion of this
on the lifecycle methods, since any library that wants to extend the options map will not have access to the same feature (there is no way for me to know if they are mean to be static or not).
So, methods like componentDidMount
would need to specifiy this
under the new model, but static ones would not. In other words, you’d be writing them to match what would be expected from the React docs.
The continues to be a little confusing because the eye (and IDE) will continue to resolve the “args” in the context of everything in the options map.but dropping any “special” support except for the core query/ident/initial-state also means that you can use new React ones as they appear over time in that library without needing me to change anything in Fulcro
There’s one other thing I could do that would be undesirable in my opinion, but would at least make things more consistent: I could rewrite the bodies of the lamdas to expand props with your arg list destructuring so you could actually use the args…I like that for the consistency aspect, but dislike it from the “extensible” and “did you really pass this
as the first argument to that???” aspect…so I don’t really like that option very much.
I could also just make the thing non-magic. Make a new macro that looks more like plain def (no args list) and you repeat things in the various places. I dislike that because it is uselessly repetitive, and requires a lot of porting effort to use.
So, if anyone has addl suggestions let me know, but perhaps ppl could vote for their preference of these options with Slack reactions:
1. Make it work exactly like it does in 2.x (arg list of defsc
is used “as much as possible” in lifecycle methods…mostly this
)
2. Keep functionality of query/ident/initial-state, but make everything else unrelated to the defsc arg list (e.g. you’d write :componentDidMount (fn [this] …)
)
3. Expand the defsc
arg list support into non-static react lifecycle methods so that the defsc props
arg/destructuring is available whenever possible (e.g. rewrite your lifecycle bodies to have a (let [props-arg (comp/props this)] [email protected])
around whatever you write. This has a runtime performance penalty, but makes the props arg closure look consistent across as much as possible.
yeah option 2 seems like a nice middle-ground
3 is tempting but a more complicated macro is more likely to have compatibility issues as react evolves and corner cases arise
Thanks everyone…glad to see that my intuition matches with general community desire.
I like option 2 too
+1 for 2 🙂. Mentally ’everything other than these 3 core fulcro keys is easy to keep track of