Fork me on GitHub

@thomas (-> env (uism/load …))


or load-actor


By design you are supposed to set actors at the start of the state machine. Presumably your list of data would be one of the actors, with a known ident


the UISM ns has functions for pulling the actor class, ident, etc.


How would you gauge adoption of Fulcro?


I see this is very interesting technology, but how does it compare to for example Reagent and Reframe? How popular it is, how many users it have?


It’s most likely wildly misleading in either direction, but you could look at the number of participants in this channel. I’m curious, what do you plan on doing with this information if you manage to find it out?


I am just considering which technology to learn.


Are there any direct alternatives to Fulcro?


@slawek098 How many people adopted Angular 1? Did it matter?


pls have that discussion elsewhere 🙂


If you have a technical question about the appropriateness to a task, it is welcome…popularity contests are a misuse of my time and others. Real businesses use it for real things.


See subject line for a list of resources to use in evaluation.


@tony.kay Sorry if you felt offended - I really appreciate enormous amount of work you've put into Fulcro and I haven't seen anything like that in Clojure - and that's why I was curious how popular it is, because by completeness of this project, number of commits etc I'd expect it to be super popular and kind of "go-to solution".


not offended


OK. Sorry again!


no worries…my point is that generic comparisons are difficult, and popularity is not a good indicator of what you probably care about.


you can adopt the most popular thing on the planet and be hosed a year later


Yes, but it does matter when you are looking for job - I've seen offer asking specifically for Fulcro skill.


and Fulcro is not trying to address the same things as Reagent/reframe (which are only concerned with front-end)


Yes, that's what I like in Fulcro!


if you’re looking for a job, stick to vanilla js 😜


Not having to connect 10 separate components for simple project.


Just to PoC something quickly.


yeah, if you know Fulcro well then that is a great thing about it…many ppl would disagree with you though, saying they rather PoC with Reagent or Rum. To each their own. Simple vs easy vs appropriate-for-the-job.


but some simple research will get you numbers from Clojars: • rum 110,000 downloads (lifetime) • re-frame 800,000 downloads (lifetime) • js Redux 3.8 MILLION a WEEK • Fulcro 28,000 of v2.x, 4,000 downloads of 3.x (lifetime)


we’re in clojure-land…our popularity is very very very low. Of the items in clojure-land, Fulcro is less than 1/10th as popular as others.


probably 3x harder to learn (not to discourage you, just reality: Fulcro has more parts…in the long run I think it is much much easier to use on commercial-size projects)


@slawek098 on the learn side, one interesting thing to consider is that by learning fulcro you will learn a production tested UI data model, even if you don't use fulcro that's a very good trick to have internalized, this is something I didn't see any other React library do (considering all normalization, server integration, etc...)

💯 20

I'm trying to load updates but I'm having a hard time convincing Fulcro to merge my to-many edges instead of replacing them. I've tried using :append-to, but that will create duplicates when given a list. I've tried using pre-merge to reappend the previous edges, but that makes the mark-missing function fail. My current idea is to load it with a temporary target and have a separate merge post-mutation. Is there a simpler way?


one way is to use a :target to initially merge the results in a separated part of the db, them use a post-mutation to assemble the data in any way you want


Yes, makes sense, but I ran into problems with that too, because only the entity itself is placed at the separate target, it's contents are normalized and therefore overwrites existing entities.


So I have a Company with Employees, and to a parameter that says I only want entites that are newer than the given transaction id. I'd like to load it with a query like

(df/load! this [:company/id 10] Company
          {:params {:since-tx 13194139533344}})
Which gives me a response like
{[:company/id 10]
 {:company/employees [{:employee/id   200
                       :employee/name "Foo"}]}}
And I cant figure out how to merge the list of employees with whats already there.


Is there an Employee defsc with an ident? If so, does company/employees wind up as a vector of edges? Are you saying you want to merge the new vector of edges with the existing vector of edges for the given company? Like

  {:company/employees [[:employee/id 200] [:employee/id 201] [:employee/id 202]]} 
  {:company/employees [[:employee/id 300] [:employee/id 301] [:employee/id 302]]})
And you’re finding you now just have employees 300,301,301 instead of 200,201,202,300,301,302?


Yes, that's what I'm saying. In your example something like

(merge-with (comp vec concat)
            {:company/employees [[:employee/id 200] [:employee/id 201] [:employee/id 202]]}
            {:company/employees [[:employee/id 300] [:employee/id 301] [:employee/id 302]]})


The closest I've got is using append-to like this:

(df/load! this :all-employees Person
          {:params {:target   (targeting/append-to [:company/id 10 :company/employees])
                    :since-tx 13194139533344}})
But then I don't know how to just get the employees of company with id 10. And append-to, with to-many edges, does not remove duplicates. And I need to repeat the logic for company/customers etc.


I’m not aware of any Fulcro helper for this particular need, but that doesn’t mean there isn’t a better way than what I know. The way I would do it is to set :target to something like [:company/id 10 :ui/temp-emps] and then have a :post-mutation that does the merge manually.


I’m curious why you don’t want to just replace the employees vector if you’re getting :all-employees ?


where are the other edges from?


@U0773UB6D gotcha, because or normalization you get the data merged and lost, one way around it is to trigger the load with a query without normalization, if you do that them you will get it merged as raw, giving you control, you modify that and merge again with merge-component in case you have some complex data to normalize


I guess I’m unclear what exactly is getting lost during the merge?


I do something similar and it works without losing data even if I do a load with a subcomponent that only has one key in the query, it merges into existing tables and keeps the existing data.


@U0773UB6D what do :ident and :query look like on your Comp and Emp classes?


@U066U8JQJ right, I'm currently trying to use my own :ok-action to override the default merge behavior. Using merge-component on the parts to get some of the functionality back might be a good idea. Thanks! @U07KXN95L The "other edges" are an update, they are employees that got added after the first load was made. The :since-tx params tell the resolver to not really return all employees, but only those that are new.


I see yeah I would probably do the second query :all-employees because it makes it more clear that your :since-tx param is only referring to new employees, and also add a :company-id 10 arg to the params. then target a temp variable and do the merge manually, finally deleting the temp state. So something like:

(df/load! this :all-employees Person
          {:params {:target [:company/id 10 :ui/new-employees] :since-tx 13194139533344 :company-id 10 :post-mutation `merge-emps :post-mutation-params {:from [:company/id 10 :ui/new-employees] :to [:company/id 10 :company/employees]}}})

👍 4