This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-31
Channels
- # beginners (153)
- # cider (30)
- # cljs-dev (8)
- # cljsrn (8)
- # clojure (105)
- # clojure-dev (6)
- # clojure-dusseldorf (5)
- # clojure-italy (6)
- # clojure-nl (3)
- # clojure-russia (34)
- # clojure-spec (23)
- # clojure-uk (54)
- # clojurescript (104)
- # core-matrix (3)
- # crypto (1)
- # cursive (17)
- # datomic (90)
- # duct (13)
- # editors (5)
- # emacs (1)
- # events (1)
- # figwheel-main (9)
- # fulcro (54)
- # hoplon (18)
- # hyperfiddle (2)
- # jobs-rus (1)
- # lein-figwheel (5)
- # leiningen (3)
- # luminus (52)
- # mount (6)
- # off-topic (22)
- # other-languages (3)
- # parinfer (7)
- # powderkeg (3)
- # re-frame (52)
- # reagent (58)
- # rum (4)
- # shadow-cljs (49)
- # spacemacs (12)
- # sql (13)
- # tools-deps (2)
- # yada (1)
Hi, I’m trying to use fulcro-sql, standalone. I’m trying to pass a #uuid
in the root set, and it appears the query is choking
If I pass “?” as a root set, the query is correctly interpreted as wanting params, but I don’t see a way to pass them in to query?
is :ui/loading-data
supposed to work with a websockets remote?
@arohner fulcro-sql assumes your ID will be understood in an IN clause as-is, and does no interpretation. UUIDs won’t work in SQL the way it is embedding them 😞
@currentoor you mean load markers?
load makers happen at a higher layer than remotes, so yes, they should work as documented
oh this is for mutations that happen over websockets 😅
oh i see
Although I think the global activity marker is supposed to light up, which is what you’re talking about, right?
> Thus, only the global activity marker is available for mutations.
it lights up for file uploads happening over http, but not for websocket requests though fulcro inspect correctly displays both as pending when they are pending
well, I suppose technically it should probably be considered a bug, since you might want to know when mutations are still in flight
yeah that’s what i needed
though, since i’m using ptransact
for this particular call i suppose i could just add a custom load marker before and after my blocking mutations
It’s kind of a messy thing to track, actually, since there can be an arbitrary number of remotes running either loads or mutations, the latter of which are just closed over in an async network op
loads are relatively easy, since we track load markers to keep track of what we’re doing with the returned data.
combine that with the fact that you can make non-sequential remotes (where you could have many mutations in flight at once) and it gets really tricky
actually, it might be tractable to fix. send-payload
in application.cljc is the central spot where callbacks are composed for the async process…we could add a (atom #{})
in the reconciler (requests-in-progress), assign each network request a UUID, and just make the callbacks remove their UUID when done. “active network” would just mean this set was non-empty.
I don’t have time to test it, but if you’re interested I could show you approximately what to do
i’m a little pressed for time at the moment, i’ll make a notes of what you’ve said above and revisit later, in the meantime i should be able to get by with a custom load-marker (that’s tied to this specific mutation finishing)
right, yeah
an unfortunate naming badness…the app state is in (-> reconciler :config :state deref)
but wait in app state there’s also :fulcro/loads-in-progress
what about that?
oh, not mutations, got it
@tony.kay i’ll try what you just suggested
I’m open to it, but I’m not spending much time on that particular lib. The advent of pathom and walkable https://github.com/walkable-server/walkable sort of make it obsolete
Mine was more of a proof of concept to show people one way to go about it. These days I would personally use pathom https://github.com/wilkerlucio/pathom as a general-purpose solution.
Pathom is just a completely general way to build parsers easily for the server-side processing. Data source doesn’t matter, and it makes it easy to build.
You will have to be careful with the possible N+1 query problem, but that is solvable (walkable is actually written on top of pathom, I believe)
You can get an idea in this YouTube video: https://www.youtube.com/watch?v=gbrdnSsUerI&list=PLVi9lDx-4C_Rwb8LUwW4AdjAu-39PHgEE&index=15&t=1459s
it shows a couple ways of doing it, and the timestamp I’ve embedded is roughly where I talk about using pathom connect with SQL.
:queued-sends
appears to be empty the whole time
@arohner Given that your desired UI query often doesn’t match your database, pathom connect is super useful to “invent” UI graph parsing against your database (or any data source).
@currentoor in fulcro incubator I have some snippets from code to handle progress over mutations, there is a limitation that you can't track more than one event per identity, but it can take some time until this gets to be a real problem: https://github.com/fulcrologic/fulcro-incubator/blob/develop/src/fulcro/incubator/db_helpers.cljc#L304-L343
thanks @U066U8JQJ i’ll check it out
np, also check the defpmutate
macro, it can help to generate the mutations for the process: https://github.com/fulcrologic/fulcro-incubator/blob/develop/src/fulcro/incubator/db_helpers.cljc#L259-L267