This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-11
Channels
- # aleph (1)
- # aws (4)
- # aws-lambda (5)
- # beginners (85)
- # cider (39)
- # cljs-dev (3)
- # cljsrn (1)
- # clojars (1)
- # clojure (129)
- # clojure-italy (14)
- # clojure-nl (5)
- # clojure-nlp (1)
- # clojure-uk (61)
- # clojurescript (52)
- # cursive (3)
- # datomic (42)
- # duct (3)
- # emacs (9)
- # fulcro (60)
- # graphql (2)
- # juxt (2)
- # keechma (1)
- # leiningen (4)
- # midje (2)
- # off-topic (8)
- # onyx (3)
- # overtone (1)
- # re-frame (22)
- # reagent (51)
- # reitit (3)
- # remote-jobs (3)
- # ring (4)
- # ring-swagger (1)
- # rum (4)
- # shadow-cljs (14)
- # specter (28)
- # tools-deps (85)
- # vim (9)
Fulcro 2.5.8 is up on Clojars. Fixes a bug in server-side rendering reported by @levitanong, and a websocket bug that where early sends to the server could cause errors while the websocket was establishing. Also fixes a bug where :component
could be nil within mutation handlers if the component had no query.
hmm, I can't use qualified keywords for my route params because the fulcro syntax for routing tree use prefix: param/...
;; current fulcro syntax
(r/routing-tree
(r/make-route :my-screen
[(r/router-instruction :router [:my-screen :param/x])]))
;; my dream syntax so qualified keywords work
(r/routing-tree
(r/make-route :my-screen
[(r/router-instruction :router [:my-screen {:param :qualified/x}])]))
yep. The built-in routing is tuned for use with URI-based parameters, which are not qualified. Feel free to write your own. The code for the existing (non-dynamic at least) routing stuff is very little code.
The routing tree is a very simple thing I threw together to set idents on more than one router at onceā¦but it is just that: a mechanism to combine setting multiple idents on routers into a single mutation. Thereās nothing magic about it unless you want to integrate with code splitting.
(defcard-fulcro repayment-state-card
Root
{}
{:inspect-data true
:fulcro {:started-callback
(fn [app] (df/load app :foo loan-comp/RepaymentItem {:target (df/append-to *[:REPAYMENT-LIST :singleton :repayments]*)}))}
})
I used initial-state to give this position a [], Why this position is still nil so that it canāt be appended. Which happen first, initialState or :started-callback?š@eric.shao initialState
will happen first since it goes at app initialization process, right after that your started-callback will be triggered
@wilkerlucio I want to load one {} or a [] to append to the initial-stateās list. There are three situations 1: when I donāt provide fulcro-started-callback, the initial-stateās list [] will show correctly. 2:when i df/load a {} it will fail 3:when i df/load a [{}] it will replace the initial-stateās list (instead of appending to that list) and report
for append must target an app-state vector.
(vector? (get-in state data-path))
If the initialState happen first, there should be a [] , and it should be appended instead of replace, right? where is the problem?
@tony.kay does fulcro support running the app āserver-sideā? Like, creating a fulcro client, running loads, fulcro networking etcā¦
@levitanong no, but if you follow the patterns in the book all of your mutations will have helpers that can be used to simulate just about any action on the server
Not sure why youād want to ārun itāā¦how would you interact with it? Once itās on the initial screen events are needed to ādrive itā to some state
and since those āeventsā are always mutations, simply having those in functional form on the server gives you exactly what you want without any āmachineryā in the way
@tony.kay The use case is when, for example, I need a set of itineraries that tell the user how to get from one latlng to another latlng. If I want to SSR, then the html I serve should already have those itineraries out. I was thinking that if, when the server receives such a request, it instantiates an app (a client running on the server, in other words), to perform requests from another server (the server the client-client would talk to)
if I could do that, it would be easier to reason about
plus, lots of nice code reuse
think of all of that machinery that can break and make it ānot workāā¦debugging, setup, testing, devops
the problem is, i donāt.
the server is primarily a webserver. it doesnāt hold the routing, reverse geocoding, etcā¦
(by routing i mean in the google-maps way)
currently no. thatās something thatās definitely in the roadmap though.
the login stuff is primarily for preferences, so itās safe to be rendering the stuff
the motivation for SSR right now is SEO
the itinerary thing is a simplification š
Your best bet is really to use CLJC for the client mutations, and do the manipulation of data and only data on the server, then render that with SSR
āloadsā will have to be implemented to do JVM-based networking if you need to hit other servers to satisfy external data needs
but the merge
functions in Fulcro will work on the server against state maps, so you can get very close to complete sharing of code
i see
i do suppose the statefulness of the instantiated app would be overly complex
and maintaining two ways of dealing with networkingā¦along with the alternate paths wthin Fulcro itselfā¦itād be a constant source of inconsistencies andbugs
the thing that actually pushed me over into asking about instantiating an app though, is in the case of invented-root-level-keyword loads.
and at the end of all of that probably wouldnāt save you hardly any coding, since you could have already used CLJC shared code to ārun arbitraryā operations server-side
because client-side, i have something like :placename->location
and :location->placename
. Both touch āplacesā, but fill up complementary deficiencies in information
as opposed to using an ident
and i wasnāt sure how to marry those invented keywords with the merge
function
or maybe i know how to make it work, but itās just one kind of mess that I wanted to cover up with a different kind of mess. š
oh, those seem new!
the !
form of them are mutations, and the non-`!` form can be used on server or inside of mutations
got it! thanks @tony.kay š