Fork me on GitHub
#fulcro
<
2020-07-17
>
thosmos12:07:44

I’m having a problem where I’m using comp/transact!! on fields in a sub-form modal. My sub-form changes into dirty state and the UI updates accordingly, but the parent isn’t seeing the changes, so when I trigger “save” on the parent form from the sub-form’s modal, the changes don’t propagate to the back-end because fs/dirty-fields at the parent returns nothing.

thosmos13:07:07

The problem was from calling fs/mark-complete* from within the comp/transact!!. I instead made a second comp/transact! that just calls fs/mark-complete! and that seems to fix it.

daniel.spaniel14:07:58

anyone doing backend pagination? with datomic? i was doing front end pagination ( get full list of items and paginate on those ) but too many to handle now. with datomic i found the limit and offset and not deterministic, so do i have to get all items in query and sort and limit and offset manually ?

thosmos16:07:21

@dansudol that’s how I’m doing it. One possible improvement I haven’t tried is only getting the db IDs (and minimum sort keys), paginate those, then only retrieve the entity bodies for the current page of ids

daniel.spaniel16:07:09

gotcha thosmos, that is another idea too

thosmos16:07:45

(defn limit-fn
  "Collection pagination mimicking the MySql LIMIT"
  ([quantity coll]
   (limit-fn quantity 0 coll))
  ([quantity start-from coll]
   (let [quantity   (or quantity 20)
         start-from (or start-from 0)]
     (take quantity (drop start-from coll)))))

thosmos19:07:31

Also d/qseq returns a lazy collection that’s useful if you don’t need to sort before paging