This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-30
Channels
- # aws (2)
- # beginners (139)
- # boot (9)
- # cider (1)
- # clara (2)
- # cljs-dev (35)
- # cljsrn (3)
- # clojure (112)
- # clojure-dusseldorf (9)
- # clojure-greece (6)
- # clojure-italy (13)
- # clojure-russia (160)
- # clojure-seattle-old (1)
- # clojure-uk (79)
- # clojurescript (85)
- # clojutre (1)
- # community-development (11)
- # core-async (32)
- # cryogen (2)
- # cursive (5)
- # data-science (16)
- # datomic (2)
- # events (1)
- # fulcro (29)
- # funcool (1)
- # graphql (4)
- # immutant (5)
- # instaparse (20)
- # jobs (2)
- # juxt (6)
- # leiningen (11)
- # luminus (21)
- # lumo (1)
- # off-topic (7)
- # onyx (20)
- # parinfer (33)
- # pedestal (4)
- # re-frame (41)
- # reagent (34)
- # ring-swagger (14)
- # rum (5)
- # spacemacs (9)
- # specter (11)
- # sql (14)
- # test-check (3)
- # yada (20)
“Core Concepts Part 3 – Data Driven” is up on YouTube: https://youtu.be/QsRpZJBhoW4 This shows how a graph-capable library/database (I use the new fulcro-sql in the video) leads to data driven applications. It covers deferred loading and targeted loading, and shows how little code is required to make a server that can respond to diverse client needs.
So, the server-side rendering on template had a problem. If you use a browser that doesn’t set a language (accept header) then it dies on logging…because the error call in clj didn’t match it in cljs (my API was inconsistent in the cljc file). This is fixed on the template, but needs beta10-SNAPSHOT of fulcro. Worked fine in Chrome, but I tried it with Safari and Firefox and was surprised by it 😕
@cjmurphy I haven't figured out how to do a join that uses get-query. Say my Person query is [:db/id :person/name :person/company], and my Company query is [:db/id :company/name]. In the Person query, I guess I could add (om/get-query Company) pull in all the companies? Then I think I need something like {[:company/by-id :person/company] [:company/name]} to get the name of the person's company? But I can't get it to work.
Almost every IQuery will have a get-query
or two in it. Only ones that don't are on the edges, where there are no more to-one or to-many relationships to explore.
It is a very old demo, but I like it because it is biggish, and will surely show you lots of relationships - take a look at the Kanban Om Next demo.
@denis-v Don't know if this helps. Still figuring stuff out, this is how I do a join with get query. https://gist.github.com/claudiuapetrei/618b433ad4b9476bf99e31bf575ad1cd
Regarding what you said, my first thought would be when showing the Person, the mutation will look through the state in companies and another key that has the relation between company/person, and put in the :person/by-id {:id {:companies [[:company/by-id 1] [:company/by-id 1]]}}
@denis-v the devguide has detailed examples and walkthroughs. The getting started materials also show joins. There are hours of videos on youtube. All of those show this central concept from all different angles.
@tony.kay :elide-asserts true
was causing the problem with reads being dropped from the queue. As to why, I have no idea.
Anyone wanting to see fulcro-sql in action, you could watch about 2-5 mins of this video starting here: https://youtu.be/QsRpZJBhoW4?t=10m52s
@gardnervickers Hm…anytime there is a fix with no “why”, I worry that it isn’t a fix
e.g. is it just changing timing to run more asserts? Is there an assertion that is throwing behind the scenes that keeps something from running that is breaking it, which is backwards from the purpose of asserts (an assert throwing shouldn’t cause things to work)
@denis-v I just went back and read your original question. I think you’re making it much more complicated than it is.
We had the same bug crop up when doing a load from withing an om/transact!
in response to a user event (button press), so it being a timing issue seems less likely. I'm hoping to get a chance this week to get something more minimal to repro with and actually figure out the cause.
Maybe "remedy" is a more appropriate word heh
@denis-v the idents are an implementation detail of normalization that you can also choose to query. Querying an ident is a (relatively) rare thing. Normallly, your database will have the relations established in the graph already. So your state from person to company would be something like:
{ :person/by-id { 1 { :db/id 1 :person/company [:company/by-id 99] ...}} ; THE JOIN IS EXPLICIT IN STATE
:company/by-id { 99 {:db/id 99 :company/name "Acme Corn Huskers" }}
:current-person [:person/by-id 1]}
and your UI joins would just be:
(defui Company
static Ident (ident [this props] [:company/by-id (:db/id props)])
static IQuery (query [this] [:db/id :company/name])
Object (render [this] ... render company name from props ...))
(defui Person
static Ident (ident [this props] [:person/by-id (:db/id props)])
static IQuery (query [this] [:db/id :person/name {:person/company (om/get-query Company)}]) ; JOIN PROPERTY (in state)
Object (render [this] ... render company using factory on Company and data from :person/company props ...))
(defui Root
static IQuery (query [this] [{:current-person (om/get-query Person)}]) ; JOIN PROPERTY at ROOT (in state)
Object (render [this] ... render person using factory on Person and data from :current-person props ...))
@tony.kay How well do you think fulcro would work in an electron app? In the app I'd like to develop, nearly everything would be local, machine-wise, so the remote would likely be IPC calls to the main process for things like preferences, doing work, etc.
@driphter yes it does, I did some apps with that
here you can find an example of implementing a custom network using IPC (this example is for a Google Chrome Extension, but the electron version would be very similar)
backend part: https://github.com/wilkerlucio/youtube-gmail-queue-plugin/blob/master/src/background/ygq/background/main.cljs
frontend part: https://github.com/wilkerlucio/youtube-gmail-queue-plugin/blob/master/src/popup/ygq/popup/core.cljs
no problem 🙂
@driphter one thing to notice, on the network there's being a breaking change since I did the last update on this project, so make sure you fix the start
signature if you are using the latest fulcro, it doesn't take the app
argument anymore