This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-23
Channels
- # announcements (18)
- # babashka (65)
- # bangalore-clj (14)
- # beginners (80)
- # bristol-clojurians (1)
- # calva (4)
- # chlorine-clover (3)
- # cider (39)
- # clj-kondo (5)
- # clojars (1)
- # clojure (134)
- # clojure-france (1)
- # clojure-losangeles (3)
- # clojure-nl (1)
- # clojure-uk (7)
- # clojurescript (17)
- # core-typed (22)
- # data-science (1)
- # datomic (6)
- # duct (9)
- # emacs (48)
- # fulcro (58)
- # graalvm (37)
- # kaocha (2)
- # nrepl (1)
- # reagent (8)
- # shadow-cljs (20)
- # specter (1)
- # tree-sitter (5)
- # xtdb (3)
Hi all (and I guess, Particularly @tony.kay !), I'm extremely intrigued by the promise of fulcro for a new product.I think it might solve a bunch of practical problems I've struck in the past. I was thinking something in Clojure solves a lot of it, when I stumbled across fulcro, while trying to find out what happened to Om-next As it won't just be me, I'll need to convince others. My concern is it seems there's quite a learning curve to productivity, before it might all click in place. Particularly as my collaborators have little or no clojure experience, vs my little to some :-). The immediate use case is relatively simple, and per @tony.kay's response to this reddit question https://www.reddit.com/r/Clojure/comments/6upzgf/general_consensus_on_fulcro/ for this project it may scarcely matter what we use. But it will inform future direction. Therefore, I'm interested in the most compelling resources/approaches you know? I've watched, and recommended Tom Toor's presentation. https://www.youtube.com/watch?v=PMbGhgVf9Do I've started working through the book and have the very basics going from the template. I found walkable's realworld implementation, https://github.com/walkable-server/realworld-fulcro but lein run just doesn't work
(Caused by: java.lang.IllegalArgumentException: No method in multimethod 'init-key' for dispatch value: :fulcro.module/cljs-build-options) and the project hasn't been touched for a year.
The last time I was looking at fulcro (6 months ago, maybe?) it seemed the book and template project was in a limbo between 2.x and 3. I get the impression that 3 is now the place to start?imo watching the youtube tutorial videos (https://www.youtube.com/watch?v=wEjNWUMCX78&t=1s) makes the documentation a lot more digestible
@U2LUY0P8B author here. Fulcro 3 has been around for a while. Although Fulcro 2 and 3 share the core ideas, v3 is packed with lots of well thought ways of doing things. You should stick to it instead. The said realword app was developed by me as a way to learn Fulcro 2 myself, so it contains quite a few limitations as a new learner
both Fulcro and Duct framework are amazing frameworks, however I don't recommend trying both of them at once. Get familiar with one of them first
thanks @UPH6EL9DH I had started watching them on a commute, but on a phone screen, so not the most absorptive 🙂 I'll definitely go through them at my computer
thanks @U0E2YV1UZ I recognised the name immediately 😉 part of the reason fulcro is so appealing is it reminds me of a lot of the patterns I had in an surprisingly novel inhouse framework I was lucky enough to work on in a bank for a number of years, but updated for the web. But then how all of these ideas apply to a language I'm infatuated with, but not aufait/fluent in... well that's the kicker 🙂
Hey, Fulcro 3 is definitely the one to look at, 2 is only for legacy
this is a learning curve, but it also depends on your background
• js/jvm experience • functional programing • intelliJ or emacs experience • etc
fortunately fulcro is well documented and the book explains everything
I know Clojure(Script) quite well and have worked with Om and Reagent + Re-frame in the past, as well as with React and JS. So I have quite a good starting point yet I experience there is indeed quite a learning curve. I am quite excited about the promise of Fulcro, that's why I am working hard to learn it enough to try to sell it to my team instead of TypeScript+React+Redux. If you are quite new to ClojureScript and your needs don't warrant the use of Fuclro, I would strongly consider starting with Reagent (+ Re-frame). I think it is much easier to start with and it worked well on my previous teams. Come back to Fulcro when you have experiences with ClojureScript frontend development. That's my 2 cents. On the other hand, if you have the time to really dive into Fulcro, learn it well, implement something in it before selling it to your team, then feel free to go ahead 🙂
Interesting perspective @U0522TWDA. I have some personal project experience with Reagent and Reframe. I recently watched Tom Toor's talk too, and found his arguments convincing. However, Fulcro does seem like a lot to digest. Also, the fact that you're recommending Reagent and Reframe for starters gives me pause. It seems like a good SPA framework should be helpful for beginners and experienced alike. It seems like learning an "inferior" framework before moving on to a superior one would be a waste of time.
Fulcro is "batteries included" - it gives you more but requires more investment from you. Reagent is not inferior, is just better match for different products.
I'm looking for an example of how to use data from a third party REST API in my Fulcro application. Can anyone point me towards such a thing?
I'm guessing I would need to use something like clj-http in a Pathom resolver to achieve that?
@alex.sheluchin you can • make requests from pathom resolvers/mutations (with clj-http or any other http client) • make requests from browser (with ajax-cljs or cljs-http or anything) the more interesting question is how to normalize/store/sync 3rd party data, but that depends on the problem
I guess the best resources are just those libs READMEs, it’s actually pretty straightforward: make a request => process the result. In case of clj-http you’d probably want to go with a synchronous version (default), so that’s just one function call.
The normalize/store/sync part depends on your problem and stack. Like, you might want to have a scheduled job for syncing, or to use Datomic’s report-queue, or you might just make a request every time you need this data, or... so that depends
in case you make requests from browser, say with ajax-cljs, it might be something like
(ajax-request
{:uri " "
:method :get
:headers {...}
:format (json-request-format)
:response-format (json-response-format {:keywords? true})
:params {...}
:handler (fn [[ok? result]]
(when ok?
(comp/transact! app [(save-result {:result result})])))})
where save-result
might be something like
(defmutation save-result [{:keys [result]}]
(action [{:keys [state]}] (swap! state assoc ::result result)))
and then you can access it from components via link queryor you may save it as an attribute of particular component and access just like any other attr (without link query)
something like that inside of save mutation
(swap! state assoc-in [:component/id :my/component :result] result)
and then
(defsc MyComponent [this {:keys [result]}]
{:query [:result]
:ident (fn [] [:component/id :my/component])}
(dom/div result))
There is http://book.fulcrologic.com/#_a_rest_example (not updated to v3)
i am having the hardest of times doing a simple df/load like this one
(df/load this :dataico/analytics-data nil
{:target (conj admin-analytics-ident :ui/analytics-data)})
I get data back in an array but I get errors deep in mutation land that say
core.cljs:1226 Uncaught Error: :dataico/analytics-data is not ISeqable
at Object.cljs$core$seq [as seq] (core.cljs:1226)
at mutations.cljc:311
at core.cljs:4406
I do this elsewhere and it works fine .. the return is an array of data but something wants an ISequable
return data is
:dataico/analytics-data
[{#inst "2020-02-01T05:00:00.000-00:00"
{:count 3, :active true, :paid-up true},
:company/id #uuid "87b86c2e-19a5-4434-be61-ba395dc14e53",
:name "Acme"}]}
its this line Tony
(fn [m] (some-> m seq first meta :fulcro.client.network/progress-mutation add-progress))
in the function
progressive-update-transaction
errr .. i can do that /
I am trying to set breakpoint in there now and see what i see
looks like it gets the data but there is error on formatting
In CLJS DevTools 0.9.10, an exception was raised during value formatting.
m is :dataico/analytics-data
in the other m values i saw where all maps or arrays with 5 empty things
ok @tony.kay i figured it out
you can't do a df/load with just a keyword ( I think that is a bug in F2 )
I added params to the df/load like so
(df/load this :dataico/analytics-data
{:params {:term "moo"}})
and now the query to pathom looks like
[:dataico/analytics-data {:term "moo"})]
which is >> Iseqable <<
don't follow you, i was using nil like
(df/load this :dataico/analytics-data nil {})
already .. the fix was to add params to make the query from :dataico/analytics-data to [:dataico/analytics-data {:params blah}]
I'm getting this error in the console and hot reload is not working: > failed to load com.fulcrologic.fulcro.specs.js Error: Unable to resolve spec: :edn-query-language.ast/node
@alex.sheluchin could be you’re pinning your EQL dependency to an earlier version. Might also make sure you guardrails.edn (if you have one) is set to emit specs.
failures to resolve specs means just that: we use specs in various ways to do loose type checking at dev time. For some reason the definition of that spec is missing in your build.