This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-06
Channels
- # bangalore-clj (2)
- # beginners (55)
- # boot (32)
- # bristol-clojurians (4)
- # cider (16)
- # clara (13)
- # cljsrn (6)
- # clojure (110)
- # clojure-india (1)
- # clojure-italy (69)
- # clojure-spec (32)
- # clojure-uk (15)
- # clojurescript (102)
- # community-development (6)
- # cursive (1)
- # datomic (9)
- # docs (2)
- # duct (1)
- # emacs (39)
- # events (3)
- # fulcro (131)
- # garden (1)
- # immutant (4)
- # jobs (1)
- # jobs-discuss (5)
- # keechma (1)
- # lein-figwheel (6)
- # leiningen (6)
- # mount (6)
- # nrepl (2)
- # off-topic (69)
- # om (54)
- # parinfer (7)
- # re-frame (63)
- # reagent (13)
- # remote-jobs (1)
- # shadow-cljs (90)
- # spacemacs (8)
- # specter (6)
- # sql (16)
- # testing (1)
- # unrepl (3)
- # vim (4)
- # yada (1)
just started on fulcro and wanted to say thanks for the amazing documentation! probably the best I've seen in a clojure project
i'm trying to understand routing: I have several pages, which are selected by the router. Each page provides a different view of the db, and I had these working individually in devcards
But now that I placed a router in front of the pages, all state is prefixes with the page ident in the db
So before i had something like :campaign-list/elems [...]
, and after adding the router i get
{:page-A {:pane {:campaign-list/elems [...]}}},
:page-B {:pane {:campaign-list/elems [...]}}}
@chrisblom Add a level of indirection? So make the pages refer to e.g. campaign list 1 and put the actual elements in there?
@chrisblom Case u missed it, there's also a nice youtube video on fulcro routing ? https://www.youtube.com/watch?v=HJBI24yAdBQ
@maridonkers, thanks, adding a level of indirection worked
I may have missed this in the docs (sorry), but why does fulcro use glog
for client logging and timbre
for server logging? Why not just use timbre
everywhere?
I wish it would remove Timbre.. Timbre on the server is a real pita
But I think you can override the logger on the client
working off of the shadow-cljs
template, I’m seeing a warning like this:
[:main] Compiling ...
Failed reading cache for fulcro.inspect.ui.events: com.fasterxml.jackson.core.io.JsonEOFException: Unexpected end-of-input: expected close marker for Array
if it still fails please send me the target/shadow-cljs/builds/your-build/dev/ana/fulcro/inspect/ui/events.cljs.cache.transit.json
file
I’m experimenting into backfilling fulcro
and shadow-cljs
into an existing repo that bootstraps with boot-clj
and mount
, so… there may be weirdness and kind of hard to make small reproduce case. I’ll slowly chip away at it, and let you know if I can figure out what’s going on ;]
that should just work. the cache error is not critical as the compile will just continue without it, ie. recompile the file without cache.
the problem with boot however is that it does weird things to the classpath which may completely destroy all cacheability
I have another question. I have setup routing for pages and tabs within a page. I want to have different tabs on the User page
so for example '/user/123123/details' and '/user/123123/history', should show the Details or History tab on the User page
these have idents [:user-history/by-id :db/id]
and [:user-detail/by-id :db/id]
and I have routes in my routing tree to set the tab router to :user-detail/by-id and :user-history/by-id
However, now the db has :user-history/by-id
and :user-detail/by-id
, but i want the Details and History tabs to just show different parts of :user/by-id
So what i'm really asking is, how to I get 2 different components to render a different view of the same db entry?
@chrisblom two views of the same entity = same ident
namespaced keywords mean you aggregate data. A “user” isn’t a class…it’s a bag of facts that happen to be arranged to “make sense” as a user
it’s a user, that happens to have details, history, and other future stuff you have not even imagined
https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/EffectivePrograms.md
Search for “We want to be able to merge data from different sources, we don’t want the schemas to dominate the semantics, right?” if you haven’t seen this talk.
so say UserHistory and UserDetail both have ident [:user/by-id :db/id]
, how would the routing tree look like?
@chrisblom they have the same ident but have different queries
so with the same idents, the routing tree will look like this:
(r/make-route :user-history [(r/router-instruction :page-router [:user :page])
(r/router-instruction :user-tab-router [:user/by-id :param/id])])
(r/make-route :user-detail [(r/router-instruction :page-router [:user :page])
(r/router-instruction :user-tab-router [:user/by-id :param/id])])
sure, they may or may not share the same query
but if I understand correctly, routing is done on the first elem of the ident, so if the idents are the same, how will routing work?
My router now looks like this:
(defrouter UserRouter :user-tab-router
(ident [this props] [:user/by-id (:param/id props)])
:user-history/by-id UserHistory
:user-detail/by-id UserDetail)
I think if you have two different components then you're fine
even when they share idents or not
@drewverlee by the code it seems your component doesn't have any query, it has too, on the video the query is empty?
i’ll have to check later thanks for the hints
I guess the code is missing the :query
part, also the :ident
, if you can't find on the video just ping us back, easy fix, but if that's the case we should warn Tony so he can add some annotations on the video or something
@tony.kay @wilkerlucio fyi, Hi all, I've been working on a new library called "walkable" It's something similar to fulcro-sql but a bit more flexible It leverages path·om's power
I need to write a proper Readme before pushing to github
but basically this is how it works https://gist.github.com/myguidingstar/0926bdc8e6c930729e97679e5940deb6
@myguidingstar looks pretty cool, I like the use of parameters you did, had you though about how to handle security? (to avoid exposing other users data or query abuse)
yes, you can write custom extra condition as functions (in stead of pure data structure like in given examples)
the signature of such function is: env → condition
you can plug session information (eg user id) into env and let the function decide
by env
I mean pathom env
other kinds of guard can be achieved by some custom plain pathom plugins
sure, nice on the initiative, let me know if you need any help to figure pathom stuff 🙂
atm I just need to focus on documentation
but I haven't read the newly arrived Connect part of pathom
not sure if I can leverage it for walkable
a mix of things is possible, in the end connect
is just some extra readers, at some point it might be interesting to generate auto-complete information from the sql schema, but I think this can be added later
not sure if you saw, pathom now has an in progress book (just working on it now :)) https://wilkerlucio.github.io/pathom-book/DevelopersGuide.html
I saw you posted the doc here the other day, but haven't spent enough time on it
btw, I saw some sql being used in daveconservatoire project nodejs server
I don't know if walkable is able to take place there
omg, I should rename the source to cljc, they're all pure Clojure
yeah, it has an internal library to handle that, but the async part needs some work, right now the way it process is too agressive
can work for some range of cases, but I have feeling can bring problems at scale
you mean async part of what?
of pathom, since daveconservatoire runs on nodejs, most of the things have to be async
pathom has an async
plugin that handles core async channels as attribute returns
wow, I haven't made use of that
but currently it just goes processing everything as fast as it can (and may generate too many parallel processes at once, there is nothing holding it up)
it's more useful for client side things, on clojure side it's just headaches XD
but it's on the plan to make a decent async processor, the idea is to throw the attributes to be fetched on a controlled queue
this way we can have very efficient async readers, to use both on cljs and to make parallel processing for the clojure side
just not the priority yet, the sync one works well and it's been fast enough, the current focus is on the documentation for what is there already, and document/improve the GraphQL extensions
I agree
@pithyless @mitchelkuijpers On logging: I’m planning on removing all external deps on logging, and defaulting the internal stuff to something you can easily override (like println). Choose your own logger. It should be in the next release.
@tony.kay Nice to hear about a more easily overridable logging mechanism for internal stuff. Honestly, I was just curious why there was a split between client/server; since you already were using timbre
, why not use it everywhere? I figured that maybe you hit some issues with timbre
on the client-side and switched over to glog
. Otherwise, why do it at all?
@tony.kay about queries, reading @myguidingstar example code I saw this [{(:field {:param "foo"}) [:a :b]}]
, while I've been doing this all the time: [({:field [:a :b]} {:param "foo"})]
from what you remember, the first one was always valid, or works by accident?
to be clear:
[{(:field {:param "foo"}) [:a :b]}] ; vs
[({:field [:a :b]} {:param "foo"})]
@pithyless when Untangled was first written timbre was clj only
and Om Next used the google logger, so it seems natural. Now that I’ve merged the projects, there is no need to split
@wilkerlucio good one. David Nolen wrote the ast parser…you’d have to ask him. I’ve always done the parens as outer, and my opinion is that the other works by accident.
I’ve never seen an example or document that uses the parens on the inner prop of a join
I actually like the one inside much better, the outside one makes hard to associate the param with the requested key
inside its cristal clear IMO
good point. I tend to agree…read the AST expressions and see if it looks like an accident…might be worth changing the docs to suggest that way
but I noticed the internal one doesnt work with the fulcro client parser... Im going to debug that in a bit
it doesnt find the key when we write the query that way, dont know why yet
Im doing groceries, I’ll be back in 10, so I can type better :)
well, nothing in special, I'm writing some demos for the fulcro graphql network
and was convenient to just place the query with the params there
it works fine using the outside version, but not the internal
but that's weird, it should rely on the AST
no, it can’t rely on just the AST…it’s a recursive data walk using the query as a guide
why not the AST as a guide, using the query doesn't introduce complexity to deal with the variations?
ok, I'll see how hard it is to make it compatible
it is true that it should probably have been written to convert the query to an AST first, then do the algorithm…
db->tree
is also our biggest performance overhead on the client…so rewriting it would be nice if we could make any gains there. We have a reference implementation 🙂
sure, I wonder if the pathom implementation is faster than the current, probably not, but it's way simpler to understand
yeah, it's not hard, just have to use the correct functions, into
for example use transitive structures
by the way, I think develop
is broken
I tried to start a REPL and it complained about not finding some log deps
humm, ok, let me try
had you tried stopping the REPL and launching a new one?
no problem 🙂
@tony.kay can't find tests for db->tree
, do they exist?