Fork me on GitHub
#fulcro
<
2017-12-21
>
tony.kay04:12:21

Fulcro-inspect 2.0.0-alpha3-SNAPSHOT has an improved version of the history visualization when you slide around in the history of the data viewer. I moved it out over the main app so the CSS there could take effect. The results mostly work. The cascading of styles isn’t ideal. Any CSS gurus want to make it better, I’d love some help 🙂 The CSS for it is here: https://github.com/fulcrologic/fulcro-inspect/blob/01c53db684fdecf0e4c5295a7738ea3016d10bbb/src/fulcro/inspect/ui/dom_history_viewer.cljs#L23

decoursin12:12:36

I'm trying to slowly port a small om-next project to Fulcro. How do I replace om/process-roots it doesn't seem available in Fulcro? I would like a gradually move to Fulcro, so having something like om/process-roots available would be nice!

chancy16:12:58

Does anyone have any recommendations for digesting Fulcro for someone that's just learning Clojure and is mostly coming from Python? I have some functional programming experience coming from Elm and a tiny amount of Haskell, and no real Java experience in the last 10 years. 😅

tony.kay16:12:42

@chancykennedy So, Fulcro itself requires that you know a bit of Clojure(script). Once you get a bit of that under your belt I’d recommend the video series on YouTube as a starting point

tony.kay16:12:08

I’ll be adding to that over time. I think I’m up to 10 videos…they go from the very basics in a way you can follow-along with

tony.kay16:12:36

@decoursin So, you can’t do remoting through the parser in Fulcro. Why do you think you need process-roots?

decoursin16:12:05

@tony.kay I don't know if I'd need it in Fulcro, I know you obviously do without it. I was requesting it to help be able to gradually convert my application to fulcro.

tony.kay16:12:03

So, I helped write process-roots for Om Next. It’s purpose is to remove/re-add UI query “above” the thing you really want to query for. In Fulcro, we don’t need it because you never have to use the root query for remotes….in Om Next it is always from root.

decoursin16:12:01

Ah that's interesting, i didn't catch when skimming your docs.

decoursin16:12:15

How do you prevent it being from root?

tony.kay16:12:34

Loads are explicit.

tony.kay16:12:59

(load this :key Component) creates a query to send to the server from the Component, and merges it. No parser involved.

decoursin16:12:01

Ah ok thanks

decoursin16:12:11

I was also wondering about keys in queries that are designed to be used locally only, if I don't write the read fns, how can I prevent them from being sent in the remote queries to the server(s)?

tony.kay16:12:10

So, to port: 1. Remote all remote from your read…new parsing read becomes your read-local for Fulcro 2. Encode your loading into calls of load and load-field 3. For keys that don’t go to server, put them in the ui namespace

decoursin16:12:30

> (load this :key Component) creates a query to send to the server from the Component, and merges it. No parser involved. This does seem much better, thank you for your contributions to om.next by the way! and all the open source you've given us!

tony.kay16:12:38

[:ui/checked? :person/name] will go as [:person/name] to server

tony.kay16:12:30

you’re welcome! A lot of the reason I do it is because I love the model and don’t really want to program in anything else 🙂

decoursin16:12:55

It seems much better than anything else I've used.

decoursin16:12:04

(on the frontend)

tony.kay16:12:21

hoping you’ll think that about the full stack once you get into Fulcro 😉

decoursin16:12:41

Yeah but it's too late for that I think, my back is already in graphql using Lacinia

tony.kay16:12:04

oh…GraphQL is fine…I’m talking about the Fulcro load vs parser

decoursin16:12:30

Which I was wondering if fulcro would work well with it. I know om-next is pretty flexible, and fulcro is more opinion-nated so I was bit worried there'd be problems.

tony.kay16:12:42

We’ll start releasing work on easier integration with GraphQL soon. Wilker’s pathom is making that story pretty nice.

decoursin16:12:08

Cool thanks yeah I saw that, I'm using his query->graphql fn

decoursin16:12:03

but I think there's probably more in his pathom that I could use, which I haven't yet.

tony.kay16:12:09

Few of the “opinions” of Fulcro should limit flexibility in a many ways. Technically, almost everything except the database storage format are still pretty open to config.

decoursin16:12:23

Cool that's really nice to know

tony.kay16:12:10

And you can always use things like DataScript as a “remote” that is stored in the browser…or customize your read-local and wire a few things up, and you can easily use other databases in tandem.

decoursin16:12:17

Yeah I never yet got around to reading the datascript om-next hookup https://github.com/omcljs/om/wiki/DataScript-Integration-Tutorial, so I'm not really sure yet how that works, but i'll keep it mind.

tony.kay16:12:21

Anyway….coming from Om Next, watch this YouTube video: https://youtu.be/mT4jJHf929Q It’s from when things were called “Untangled”, but it should help.

tony.kay16:12:43

I don’t personally recommend DataScript for general use…it’s just something people know about

decoursin17:12:05

But do you think it's appropriate for some things?

tony.kay17:12:11

Of course 🙂

tony.kay17:12:39

But I think one of the things people thing they want to do with it is sync with Datomic…that I would not bother with.

tony.kay17:12:20

Our graph syntax is already pull…it is pretty simple to make a “Meteor.js” style Datomic hook-up directly with websockets and bypass the extra overhead of syncing everything to DataScript

decoursin17:12:17

Nice to know, yeah I saw one of those projects like datsync or something, seemed interesting, that's interesting though

tony.kay17:12:03

But the fundamental proposition (of syncing with DataScript) has a number of flaws…ranging from atomic operations to over-query.

tony.kay17:12:37

I want to process an arbitrary graph query…for that to work properly I have to sync up all the entities that might be involved…but I might only need 1-2.

tony.kay17:12:53

It means you have to now invent an API to solve that problem

chancy17:12:09

@tony.kay Thanks, Tony! I'll have a go at the videos.

tony.kay17:12:20

I’ve prototyped the meteor-like thing….it was couple 100 lines of code and simple to reason about

decoursin17:12:42

Yeah, it seems like a good idea on the surface, but maybe there's too many details like some of them you mentioned that would cause huge problems.

wilkerlucio17:12:17

@decoursin I want to document more about that, the graphql things were an experiment, but given the increase interest I'll try to find some time to improve the code and docs around it, help to make it work better is welcome (specially because I'm not using it on prod, so real apps can help)

wilkerlucio17:12:39

until then, feel free to ping me if you have any questions around it

decoursin17:12:43

Awesome thank you so much. Can you just briefly outline where you think it's most helpful? I'm already using query->graphql, so you can skip that. I'm only using Fulcro/om-next on the frontend would it still be useful? If someone has a graphql backend, would you recommend using your parser over the stock om-next/fulcro one? I just don't really see how it fits yet, maybe because I don't understand fulcro completely yet either. Is it more tailored to fulcro or om-next? Sorry for all the questions just answer what you'd like

wilkerlucio17:12:40

@decoursin those tools are made for both front and back-end, depends on how you want to use it. for your case you can use on the client directly, I have an example app that makes a fulcro network that communicates with graphql endpoints directly, you can see it here: https://gist.github.com/wilkerlucio/cda2bf4a3c4c05a0ffec49cdb1eed93b

wilkerlucio17:12:55

this code was written before Fulcro 2.0, so some things might need change (probably just the namespaces)

wilkerlucio17:12:51

using the graphql network, the graphql turns into a transparent thing, the network converts the queries on send, and revert on read (you can even use namespaced keywords, they will be stripped on send, but will be attached back automatically on the return)

decoursin17:12:17

Looks great thank you, I'll have a deep look at that when I get chance (which probably won't be for who knows, I'm on holidays starting tomorrow with family)

decoursin17:12:52

Have a wonderful holidays everyone!

wilkerlucio17:12:51

thanks, you too 🙂

edward.scott18:12:30

I am using the defrouter macro and it seems as though only the first component in the router picks up its initial state. Is this to be expected or am I doing something wrong?

tony.kay20:12:34

@mandor2017 Chances are you’re doing something wrong.

tony.kay20:12:43

last I checked all the demos that require this behavior work (get initial state for all branches)

tony.kay20:12:25

show the code snippet of the router and components that have initial state ?

edward.scott22:12:08

Thanks for the response. It's getting a bit late here in the UK to fire up the PC so I will investigate further tomorrow.

tony.kay22:12:36

ok…the demos in fulcro (clone/follow readme) have a number of routing examples

tony.kay22:12:20

NOTE: yesterday I mentioned wrappedInputs. I’ve changed that to rawInputs and inverted the logic so they still default to the old way for now. Will flip it in a later version, not in a release candidate 🙂

edward.scott22:12:50

Really appreciate the effort you are putting into fulcro. Routing is the only bit so far that I have found difficult to get right.

tony.kay22:12:14

Yeah, I’ve got some ideas around improving it, but not the time just yet 🙂