This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-28
Channels
- # aleph (2)
- # beginners (25)
- # boot (12)
- # cider (73)
- # cljs-dev (3)
- # clojure (37)
- # clojure-dev (93)
- # clojure-germany (1)
- # clojure-italy (24)
- # clojure-nl (21)
- # clojure-russia (26)
- # clojure-spec (37)
- # clojure-uk (80)
- # clojure-za (1)
- # clojurescript (47)
- # cursive (4)
- # data-science (17)
- # datomic (69)
- # emacs (19)
- # events (7)
- # fulcro (41)
- # hoplon (14)
- # leiningen (2)
- # nrepl (4)
- # off-topic (253)
- # om (11)
- # portkey (2)
- # re-frame (11)
- # reagent (24)
- # ring-swagger (1)
- # rum (5)
- # schema (1)
- # shadow-cljs (106)
- # specter (2)
- # tools-deps (91)
@wilkerlucio Not sure this is the best approach, was in a rush to finish a project (fulcro 1.21 days). I have a prop in the container component :ui/append-loaded
. The post mutation looks it up and decides how to add the data. Something like:
(defui ^:once SearchQuery
static om/IQuery
(query [this] [:has-more?
{:admins (om/get-query AdminAdminsListing)}]))
(defn load-data-fn [this params]
(f-df/load this :server/admins SearchQuery {:params params
:post-mutation `m/finish-load!
:refresh [:search-results]}))
(defmutation finish-load!
[params]
(action [{:keys [state ref] :as env}]
(let [s @state
append-loaded? (get-in s (conj ref :ui/append-loaded))]))
@claudiu thanks for sharing, but this approach of having the pagination outside I think is a problem, because if you have multiple paginated collections then it falls short
@wilkerlucio what do you mean by multiple paginated collections ? 🙂
I mean, the way you said the :has-more?
is at the same level of your collection :admins
, what if also have :customers
what's a paginated
also, having it at the upper level compromises the ability to generalize the solution for the pagination UI
I like the nested structure because it allows for more meta-information like total pages, current page, and whatever else it needs
ahhh 🙂 yep. Did not reach that case. But :has-more?
it's the post-mutations job to put it in the appropriate place (using-ref). But if I had multiple collections, then each would have there "wrapper-component" & list-view component, the wrapper should have ident and hold the has-more, total-pages, current-page, collection items list.
or at least that's my current approach. Need to think about this a bit more, and see what edge-cases can pop-up 😄
@wilkerlucio trying now to get graphql with lacinia on the server, then create a graphql networking remote. In theory that is the place where I should use pathom to convert the edn to graphql, and the response back to edn ? Have you tried this on any project ?
@claudiu yes, I might have some example around, I'm in a meeting now, I can look it up later
@claudiu I was checking here, but I think the old examples will not work due to recent changes, I can help you out to make this setup because there is no ready to use example at this point
@wilkerlucio that would be great, thank you. 🙂 Still setting up some things on the backend, will try to setup graphql+pathom and give you a shout when I get stuck.
Is there a big difference in performance between dynamic routing (set-query) and the union routing ?
@claudiu nearly none. Dynamic routing relies on dynamic queries, which are AFAICT are much less used, and therefore less “tested”
Is there any reason to use dynamicrouter if I'm handling the modules loading myself vs just implementing it with set-query! ?
dynamic routers also require the reconciler on route change to process code loading…with union routers you can just use (and compose) update-routing-links in any mutation
is there any way to use react fragments in fulcro? (https://reactjs.org/docs/fragments.html)
@pontus.colliander had you tried to just use directly? I think there is nothing preventing it from been used
Do you know what the syntax would look like to use it directly? I tried
(react/createElement react/Fragment (dom/span "span1") (dom/span "span2"))
and variants of that but no luck@pontus.colliander I guess: (dom/create-element js/React.Fragment #js {:prop "value"} (dom/div "Child"))
it worked?
cool, glad to hear 🙂
I think we should add this to the dom
namespace, or some other place, since it's a react core piece
thoughts on it @tony.kay?
Yes, but we should also probably make React 16 the min version of react as well. While we’re at it we also need to support the new lifecycle methods
all of these are steps we should be taking in prep for the async rendering coming in 17 as well…there’s an issue already open
I'm still on React 15 here, but I'm planning to migrate soon
but I'm worried it might not be an easy migration, given I have tons of dependent libraries that came before
so, I have to try and see