This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-30
Channels
- # beginners (126)
- # boot (2)
- # cider (6)
- # cljs-dev (46)
- # cljsjs (8)
- # clojure (122)
- # clojure-greece (57)
- # clojure-italy (6)
- # clojure-poland (3)
- # clojure-russia (2)
- # clojure-serbia (5)
- # clojure-spec (26)
- # clojure-uk (99)
- # clojurescript (39)
- # cursive (15)
- # datascript (7)
- # datomic (21)
- # dirac (7)
- # duct (1)
- # emacs (19)
- # fulcro (58)
- # garden (4)
- # graphql (15)
- # hoplon (2)
- # immutant (1)
- # instaparse (3)
- # jobs (5)
- # juxt (15)
- # klipse (4)
- # leiningen (2)
- # lumo (52)
- # off-topic (8)
- # om (27)
- # onyx (22)
- # other-languages (3)
- # portkey (2)
- # protorepl (2)
- # re-frame (7)
- # reagent (7)
- # ring (11)
- # rum (7)
- # shadow-cljs (114)
- # spacemacs (20)
- # specter (16)
- # test-check (5)
- # timbre (1)
- # unrepl (43)
- # yada (17)
OK everyone. Last change to comment on the 2.0 name updates…I’m doing them for the next few hours. So far the list is: - Move defsc, InitialAppState, and related functions to primitives - Rename fulcro.client.core to fulcro.client I’ll ping out more if I do any others.
I think I might move the other helpers related to merging and generating state to primitives as well
Oh I love that you move InitialAppState also to primitives ^^
Ahh fulcro-inspect
doesn't work with fulcro 2.0 😢
So, while doing the renaming and heavy testing, I found a critical bug in merge…working on it, but it may take me a bit
We upgraded our next project btw, we still need om for devcards?
Wilker is working on inspect for 2.0 @mitchelkuijpers
Yeah, no worries
We got a sablono error otherwise
Yeah it does, we excluded it everywhre but it nees om.next.server
And we use defcard-fulcro
^^
strange. the author of the lib needs to fix it…they’re pulling in Om into people’s non-om projects.
https://github.com/r0man/sablono/blob/master/src/sablono/interpreter.cljc#L2 😢
Oh they piggieback on om to provide Server side rendering with sablone
I think it's not a big problem, we just added it as a dev dependency so we will get compile errors when we compile with the production profile ^^
But it is kinda lame that sablono has a hard dep on om
so, the bug I discovered causes a render with new state, but with a query based on the old props. This might actually be the path-opt bug in Om Next rediscovered…never could explain what was going on. I’ve made path-opt always the default and thought I was getting around the bug by a rework of the internals…but the exact line of code from Om Next that was path-opt is causing the problem. I’ve identified exactly what it is, but I’m still tracing why it happens. Basically, it seems that on return from remotes (on merge), the props used to calculate the ident of the component to refresh are stale. If tempid remapping happened, this leads it to use a query against the database that has an ident join with a tempid that finds no data. This leads to a refresh of your component with no props, which causes some components to throw an exception, which gets eaten by the internals (I’ve fixed this last bit which dramatically improves the debuggability). It’s almost 3am…I’m done for now 😕
Hm, I still struggle with how to implement when I have multiple views of the same entity and views of the entity paired with some extra data. I have a massive proliferation of components that have same ident, very similar queries and renders
@roklenarcic If as you say the renders are similar then perhaps they could be made less 'static' - by making the same render output differently depending on what comes in via props and/or computed props. For instance in the websocket-demo some users are highlighted and others are not.
@tony.kay about the data-load story, currently it seems we have a gap regarding data loading + init state, when we start combining elements that need :ui/...
data + data load, we need to write some manual post-mutations to get the data from the server and add the initial state
had you though about this case, you have ideas to handle this situation?
@wilkerlucio Open an issue and we can have a discussion there. Too many things on my plate today 🙂
I figured out the path-opt bug! It’s an easy fix, and would fix it for Om Next, too.
sure, no problem, I'm just curious if you ever got to think about this
I did a somewhat solution here yesterday
so if that aligns we can discuss if it's worth pulling in
what I have done is an algorithm that you give a ref and a class
and it goes traversing the data initializing everything (that is related)
but it looks at the query, find the related refs that are present, and recurivelly goes initializing the dependencies
(defn init-state
"Starting from an ident and query, scan the DB initializing the components. This should be used to initialize data
loaded from the network with fulcro fetch, this will recursively traverse using query information and merge the
initial state with the current data (data load from the server takes priority)."
([state x ident]
(let [initial (fulcro/get-initial-state x nil)
children (-> x om/get-query om/query->ast :children)
data (om/db->tree (om/get-query x) (get-in state ident) state)]
(reduce
(fn [s {:keys [type component key]}]
(if (and (= :join type) component)
(let [value (get-in state (conj ident key))]
(cond
(om-ident? value)
(init-state s component value)
(vector? value)
(reduce
(fn [s ident]
(if (om-ident? ident)
(init-state s component ident)
s))
s
value)
:else
s))
s))
(merge-entity state x (merge initial data))
children))))
it does a merge, but without overriding any attribute taht's already there (just fills whatever is missing compared to the result of initial-state)
I added the forensics to the path-opt bug here, if anyone is interested: https://github.com/fulcrologic/fulcro/issues/81
I’m going to have to loosen up the error checking on defsc due to dynamic query syntax
If anyone wants to play with the latest changes. I’ve pushed fulcro 2.0.0-SNAPSHOT6 with the renames to clojars. If you use spec, you’ll need alpha4-SNAPSHOT of that… I’m working on the refinements of defsc tonight, so that API will change slightly before alpha6 of fulcro is sent. This cleanup work is taking longer than expected…not doing a release today 😕
Any reason why the reconciler for a fulcro app would be nil?
a mounted app that is
Looking through the "getting started" docs under figwheel (https://github.com/fulcrologic/fulcro/blob/develop/GettingStarted.adoc#running-figwheel), the Cider instructions don't mention calling (user/start-figwheel)
. Is this an oversight or should figwheel start automatically upon successful completion of the cider-jack-in-clojurescript
command? It doesn't start automatically in my experience.
@U0EHU1800 I use cider with fulcro, i usually do cider-jack-in-clojure
, then call (start-figwheel)
, since i’m already in the user namespace
start-figwheel
will give you a browser connected cljs repl
@U09FEH8GN thanks for confirming. I suppose I should supply a PR to update the docs