Fork me on GitHub

General Notice: Fulcro Spec 3.0 is in out…it is a breaking change: I’m removing the browser renderers. I just don’t have the time to maintain them, they are flaky, and there are good alternatives. The shadow-cljs default test renderer is quite good at this point (I just ported Fulcro to it, and it’s fine), and Kaocha or an Emacs/IntelliJ/Vim in-editor runner for clj is better as well. The docs in fulcro-spec, and the example on develop of Fulcro show how to change up a project. Fulcro is getting a bump as well soon. I’m changing over to shadow-cljs for the development there because the experience is just so much better. I’ve pretty much got it going on the develop branch. Not sure what the version number will be yet. It should not look like much of a change externally…

👍 15

also converting them to deps.edn, which could cause some dependency weirdness…that is the main noticeable change probably

Teemu Kaukoranta14:01:42

Hi! I'm trying to follow along the fulcrologic book, but I can't get the remote data loading working. I'm at a point where my client is supposed load in the :started-callback, but I don't see anything in Fulcro Inspects Network tab, and when I try to call the callback manually using shadow-cljs's repl (with ((:started-callback @app.client/app))), I get repl/invoke error Error: No protocol method IDeref.-deref defined for type null. I've restarted the server, and refreshed the browser.

Teemu Kaukoranta14:01:32

It seems like there's something wrong with my app initialization.. even when I do

(defonce app (atom (fc/new-fulcro-client
                     :initial-state {:some-data 42})))
, I'm not seeing any initial data in fulcro inspect, and repl says :initial-state of @app is nil

Teemu Kaukoranta14:01:10

Ah, I found the bug. The template the book uses has a new reset! call in the init function. I had to add the :started-callback there instead


There’s an error in the book, or an inconsistency with the template? Either way I’d like to know about it 🙂


details appreciated

Teemu Kaukoranta21:01:08

The template defs the atom as nil, and in the init fn resets the fulcro app into it

Teemu Kaukoranta21:01:53

In the book you replace the nil value in the atom with a fulcro app

Teemu Kaukoranta18:01:30

Ping @tony.kay, not sure you noticed this


Ah, thanks…I did miss it


When I said “detail”, I was looking for something that doesn’t require me to find the exact files and lines….something like “In the book where it says “something I can search for with a reasonable chance of accuracy” and in the template in file xxx it does blah on line xxx…The book is 500 pgs 🙂


There is a lot of stuff, and my time is limited


Even better would be github links to lines. The develop guide is in the root of the fulro repo, and the lein template is OSS as well

Teemu Kaukoranta20:01:29

Ah sorry, I'll try to remember to do that tomorrow 🙂 I understand completely

Teemu Kaukoranta20:01:35

I was on mobile when I wrote that


cool, thanks

Teemu Kaukoranta11:01:18 under header "Triggering the Load". The example says to change the (defonce app (atom ..)). I think the example should be this

(ns app.client
  (:require [fulcro.client :as fc]
            [ :as df]               ; (1)
            [app.ui.root :as root]
            [ :as net]))


(defn ^:export init []
  (reset! app (fc/new-fulcro-client
                ;; This ensures your client can talk to a CSRF-protected server.
                ;; See middleware.clj to see how the token is embedded into the HTML
                :networking {:remote (net/fulcro-http-remote
                                       {:url                "/api"
                                        :request-middleware secured-request-middleware})}
                (fn [app]  ; (2)
                  (df/load app :current-user root/Person))))
I checked that this applies to the updated fulcro template too. @tony.kay


Thanks, I’ll take a look!


@tony.kay Hi 🙂 Is what I should be looking at for an up-to-date example of how to set up an application with routing?


well, “it depends” @hmaurer


The routing in there is the “best supported”.


I think the dynamic routing in incubator is going to eventually be the best…and the features are good…the problem is it isn’t battle tested yet. It is known not to work with SSR, for example.

😞 5

@tony.kay Ah, well, I have no need for SSR. I just need routing that I can get up to speed with quickly. My use-case is a fairly simple application with a login page, and once logged in a few routes (some of which with route parameters).


probably go with template for small apps


Would the dynamic routing be more straightforward to implement / play better with Fulcro ?


Also, would it make it more straightforward to load data for specifc routes then render the UI, etc?


(and show some loading indicator in the process)


all of the above


see the docs


in incubator


it has deferred routing


looking at it now


Docs look good, I’m going to give it a whirl tonight!


Additional question: is there a neat way to fit an authentication flow into this? Roughly speaking I would want to put most of the routes behind a requirement that the user is authenticated, and if no (after running a check against the server), redirect to the login route


great, love to hear how it goes…have not had much chance to use that yet


You’re responsible for calling the route functions…so your logic dictates what is reachable…I’d use UI state machines in incubator


one state machine on the top level that controls routing


of course using a diff state machine on the login screen is nice too, and the docs show an example of one of those


it seems up to date (8th dec) 🙂


yep, that’s all recent stuff


NOTE: There is a new version of the lein template. It uses deps.edn, shadow’s test renderer, pathom for the back-end, and kaocha for clj tests at CLI.

😍 20

Just tried it out tonight; it’s great. A lot of it I had to set up manually on my project (i.e. koacha); it’s nice to see it in a template. And it got me to watch a talk on Pathom


good to hear


appreciate feedback, esp from @wilkerlucio on the pathom setup