Fork me on GitHub
#fulcro
<
2020-12-30
>
stuartrexking02:12:41

I’ve added a signup uism to the RAD demo. Once the registering is successful I want to trigger the login flow, without the user having to re-enter their email and password. The LoginForm from RAD transacts the login mutation which remotely checks the credentials and locally in the ok-action checks the status and calls in the RAD auth system for either a success (auth/logged-in) or a failure (auth/failed). I’m not sure what the best approach is here. One idea I had was to have auth/Session as an actor in my uism and replicate the login mutation with a trigger-remote-mutation. Any other ideas for a better approach?

tony.kay03:12:21

The auth thing in RAD is half-baked. Just write something new. Copy the state machine out of what is there and add some more states and events to it.

stuartrexking03:12:29

Ok. Thanks. I have a half-baked solution on the half-baked RAD implementation. I feel half-baked myself after working through this.

😅 2
stuartrexking07:12:47

Is there an elegant approach to triggering a change of route from a uism? The examples I’ve seen require app and call dr/change-route directly from a handler.

tony.kay17:12:38

write a function like this:

(defn change-route-relative [{::uism/keys [app] :as env} router-actor new-route]
  #?(:cljs (dr/change-route-relative app
             (uism/actor-class env router-actor) new-route))
  env)
and make your router an actor

holyjak08:12:45

https://blog.jakubholy.net/2020/fulcro-divergent-ui-data/ is now live. Many thanks to everyone who contributed! ❤️

🎉 3
JAtkins17:12:27

Are diff added / diff removed broken on the new versions of inspect? I'm seeing nil everywhere, but it could just be my stuff being stupid.

holyjak17:12:06

Tony would accept a PR fixing it but I personally do not have time to look into it 😞

👍 1
JAtkins17:12:09

Ok. I may try to get the project spun up and work on fixing that if someone else isn't doing that already

🙏 1
JAtkins18:12:19

There seems to be a 2nd regression as well - looks like the db tab is treating state as (seq {state stuff}) and goofing up when you click an index to add to watches

JAtkins20:12:01

Scratch that last note --- not sure what happened, but that particular issue was just a fluke

tony.kay17:12:19

well, look at that, the entire issues fits here…so, reading it is even easier

tony.kay17:12:33

My apologies to the the person that opened the issue. I realize this might be a little embarrassing. I have no personal hard feelings toward you at all. I just have a need for people to be a bit more enlightened. Forgive me for using your issue as a “teaching moment”

Björn Ebbinghaus20:12:49

FYI: There is even a hooks helper namespace: com.fulcrologic.fulcro.react.hooks https://book.fulcrologic.com/#_react_hooks_support

nivekuil20:12:52

yup, although for useCallback we actually have access to that "sufficiently advanced compiler" the react docs mention and properly express its intent

tony.kay22:12:18

it’s also worth noting that if you use timbre, you already have encore, and encore has a memoize that will GC and can have a TTL. It’s a much easier thing to use that gets you 95% there with no need to even “name” your dependencies.

JAtkins22:12:32

dang. and I went to the trouble of making my own...

tony.kay22:12:56

yeah, I think everyone should look through encore…there’s a lot of useful stuff in there

lgessler23:12:12

does anyone have a strong opinion about whether keywords used for data (so, ones appearing in the fulcro db or in pathom resolvers/mutations) ought to have "full" namespaces? in general clojurians tend to prefer "full" namespaces like :com.mycompany.widget/id , but it's common at least historically for fulcro projects to use :widget/id. Personally while I'm sympathetic to the best practice of using full NSes in general, a major reason for this practice is to avoid name clashes, and if your app is never going to be a dependency for another system, and data flowing into your app won't clash with abbreviated namespaces, then I wonder whether abbreviated namespaces might be harmless and perhaps even preferable for certain kinds of readability

currentoor00:12:25

i agree with your assessment

currentoor00:12:58

non-library applications should use :widget/id, readability is very important

👍 2
tony.kay01:12:18

I concur; with one caveat: If you expect your data store to be published for use in federated data system (i.e. you might pair up with other companies and use pathom to combine data sets in a federated graph) then it is quite useful and important to use the longer names. Most people are just building some in-house thing that doesn’t need to integrate that way, so the shorter name does create less mental overhead/work/aliasing

👍 1
lgessler01:12:01

right, that's uncommon in my corner of the world but i'd expect it to be perfectly normal elsewhere... one way of having your short namespace and eating it too could be to map between short and full namespaces at the system boundaries (`:com.mycompany.widget/...` <--> :widget/...) but now you've got a mapping to maintain and the responsibility to make sure it's applied just where it's needed

tony.kay01:12:32

yep…aliasing a lot of stuff creates way more headaches than having to type a little more during dev