Fork me on GitHub
#fulcro
<
2020-03-11
>
coby03:03:49

Trying to get Workspaces set up for the very first time. Looking at the examples for Fulcro cards, I'm wondering if this defsc code needs to change for Fulcro 3? https://github.com/nubank/workspaces#122-fulcro-cards

(ns myapp.workspaces.fulcro-demo-cards
  (:require [fulcro.client.primitives :as fp]
            [fulcro.client.localized-dom :as dom]
            [nubank.workspaces.core :as ws]
            [nubank.workspaces.card-types.fulcro :as ct.fulcro]
            [nubank.workspaces.lib.fulcro-portal :as f.portal]
            [fulcro.client.mutations :as fm]))

(fp/defsc FulcroDemo
  [this {:keys [counter]}]
  {:initial-state (fn [_] {:counter 0})
   :ident         (fn [] [::id "singleton"])
   :query         [:counter]}
  (dom/div
    (str "Fulcro counter demo [" counter "]")
    (dom/button {:onClick #(fm/set-value! this :counter (inc counter))} "+")))

(ws/defcard fulcro-demo-card
  (ct.fulcro/fulcro-card
    {::f.portal/root FulcroDemo}))

Jakub Holý (HolyJak)09:03:41

the Fulcro-template https://github.com/fulcrologic/fulcro-template/ includes workspaces, look at it. I believe worksp. has a different namespace for F.3.

coby15:03:27

thanks, got the FulcroDemo card working.

otwieracz11:03:53

Looking again at React Data Grid... Is there something wrong with:

otwieracz11:03:58

(defn formatter [props]
  (ui-objects/ui-text-object (.-value props))

otwieracz11:03:13

where ui-text-object is fulcro component factory?

otwieracz11:03:09

I am getting following error:

Jakub Holý (HolyJak)13:03:02

notice that nothing follows the "in" so I guess the props are nil

otwieracz18:03:16

I don't think so. With (when-let [props (.-value data)] it fails exactly the same way.

otwieracz18:03:07

And adding print into component body I see that there are valid props indeed

otwieracz18:03:17

Hmm, wait...

otwieracz18:03:27

yay, it works!

otwieracz18:03:30

you were right!

🎉 4
sif15:03:39

the rad book mentions datomic/add-datomic-env but I can't find it in ns. Oh there is new pathom-plugin that replaces.

tony.kay16:03:34

I have some nicely focused tasks in RAD if anyone has time to help. This one is just optimizing an already working thing: https://github.com/fulcrologic/fulcro-rad/issues/16 The Datomic version of this https://github.com/fulcrologic/fulcro-rad/issues/7 requires a refinement of the current save-form logic. Right now it assumes something like :account/id means exactly that, but what we’d like to to be able to add ::attr/use-native-ids? true (or something similar) to an identity attribute and then have :account/id really mean :db/id. Also, some of the bits of this one https://github.com/fulcrologic/fulcro-rad/issues/11 are tractable. I would at least like to get the “boolean marker” option supported, and since delete is a stand-alone mutation in the state machine and database adapter it does not seem to be too much trouble, other than the resolver generators would also have to be updated to overlook things that are marked.

tony.kay16:03:47

@ecaspary @adam622 did you guys want any of that? I know you’d said you wanted to help.

ecaspary16:03:28

I’m onboarding at a new gig this week. not likely to have time until the weekend.

tony.kay16:03:51

no rush. I’ve got plenty on my plate

tony.kay16:03:58

just stake a claim if you want it

thosmos21:03:44

I’m attempting to implement this code: https://github.com/atlassian/react-beautiful-dnd/blob/591ff2c3f3fe96ece7223a0f7b46e3eedb68c5c6/stories/src/table/with-clone.jsx#L97 in Fulcro and am finding that it depends on React’s getSnapshotBeforeUpdate which then creates an optional arg snapshot in componentDidUpdate like :componentDidUpdate (fn [this prev-props prev-state snapshot]) but my snapshot value is always nil. Is there support in Fulcro for snapshots?

tony.kay21:03:56

@thosmos there is supposed to be 🙂 It could have a bug

thosmos21:03:29

Thanks. just knowing it’s supposed to be there means I’ll look deeper into my side of things …

tony.kay21:03:27

@thosmos actually it does look like I implemented it…but I don’t know if it is well-tested

thosmos22:03:44

OK I’ll look into it

thosmos22:03:08

oh yeah, problem is on my end, sorry for the trouble