This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-27
Channels
- # aleph (10)
- # beginners (139)
- # cider (47)
- # clara (19)
- # cljs-dev (2)
- # cljsjs (9)
- # clojure (94)
- # clojure-berlin (1)
- # clojure-dev (23)
- # clojure-greece (5)
- # clojure-italy (5)
- # clojure-nl (14)
- # clojure-uk (36)
- # clojurescript (85)
- # cursive (2)
- # datomic (56)
- # emacs (3)
- # events (1)
- # fulcro (33)
- # garden (3)
- # graphql (6)
- # hoplon (53)
- # jobs (1)
- # leiningen (4)
- # mount (46)
- # nrepl (7)
- # off-topic (8)
- # om (3)
- # other-languages (4)
- # pedestal (7)
- # portkey (7)
- # re-frame (1)
- # reagent (16)
- # remote-jobs (3)
- # ring-swagger (2)
- # shadow-cljs (16)
- # slack-help (2)
- # tools-deps (2)
- # yada (1)
@tony.kay re the bug report I submitted - I wasn't sure what format is best to submit. Let me know if you want me to update it in anyway. whatever's easiest for you!
awesome, just tried 2.0.0-beta2, works perfect. I think it's more intuitive this way - certainly it feels the natural approach to me.
Okay cool, no problem! Just wanted to make sure you weren't waiting on me for anything. I will see if I can dig a bit further into as well.
@chrisjswanson Also tried SUI but giving up on it. Most of the stuff I can easily do and looking at the bundle size it's just crazy... almost doubled (not to happy about the 100kb of lodash), importing components one by one does not work that well (to get dead code elimination), button+dropdown pulls in most of the code anyway. Now going for http://bulma.io + the bulma extensions for css stuff and just writing my own logic.
Yeah @claudiu I am using semantic CSS, but not their JS…most of the active components are pretty silly simple in terms of logic
How is the react “key” attribute derived for a component? Is it possible to override it?
think this is what you're looking for (def ui-person (prim/factory Person {:keyfn :person/name}))
" http://book.fulcrologic.com/#_factories
@claudiu lol yeah you're right, i think i'll take @tony.kay's approach and only use the CSS from SUI
people, did some of you implemented pagination with fulcro? I'm doing some now and I wonder how you are doing to do the pagination loads (after initial), in my approach I'm trying to wrap the pagination so it can be generalized, the query looks like this:
{:customer/paginated-purchases
[:page/next-cursor
{:page/items (fp/get-query Purchase)}]}
there 2 issues I'm trying to figure out:
1. how to trigger a load sending a param to that attribute (not to the ident join, so we can send the cursor to determine the next page scope)
2. how to add the items to the result collection, if I just load it will override the items, which is not desired
if any of you have some experience/opinions, I'll be glad to hear
ok, I think I got something that works
1. to trigger the load I had to fallback to directly calling fulcro/load mutation, so I can set the parameter right when building the query
2. I setup a post-mutation that knows the previous items, so on the post-mutation I merge then back
this is code in case anybody is interested:
(fm/defmutation merge-page-items [{:keys [abrams.page/items page-key]}]
(action [env]
(db.h/swap-entity! env update-in [page-key :page/items] #(into items %))))
(defn load-next-page [this {:keys [page-key load-config]}]
(let [ref (fp/get-ident this)
state (-> (fp/get-reconciler this) fp/app-state)
cursor (-> (fp/props this) page-key :page/next-cursor)
current-items (get-in @state (conj ref page-key :page/items))
load (merge {:query [{ref [(-> (fp/get-query this)
(fp/focus-query [page-key])
first
(list {:page/cursor cursor}))]}]
:post-mutation `merge-page-items
:post-mutation-params {:page/items current-items
:page-key page-key}}
load-config)]
(swap! state update-in ref assoc-in [page-key :page/items-swap] current-items)
(fp/transact! this [(list 'fulcro/load load)])))
ah, that is using the load directly, the df/load
calls the fulcro/load
internally
I also have a pagination example in the book. Paginating Large Lists, I think it is called…does sliding window caching so “nearby” pages are kept, and others are “released”
I was checking it now, but seems its client only, my concerns are more about client/server things on it
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SERVER:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(server/defquery-root :paginate/items
"A simple implementation that can generate any number of items whose ids just match their index"
(value [env {:keys [start end]}]
(when (> 1000 (- end start))
(vec (for [id (range start end)]
{:item/id id})))))
ah, gotcha, I stopped reading in the first section
thanks!