Fork me on GitHub
#fulcro
<
2020-12-17
>
dgb2321:12:02

Hi, this is a message of appreciation. As a freelance full-stack developer I very recently started to watch videos and follow the book. I’m excited to say the least. Over the last few years I’ve been taking more and more notes, did experiments and started to educate myself to find the right abstractions and ways to improve my productivity, the maintainability and reliability of my work. When I first noticed Fulcro a few years (?) ago I quickly discarded it as a possibility. It seemed like “too much” and I was jaded by frameworks being something I have to fight against and escape from (comming from the PHP world). At the time I re-focused on the timeless fundamentals of web development. But recently I checked the Cognitect GitHub sponsoring list (due to the sponsoring announcement) and thought “Huh, maybe there is something to it.” I’m posivitely surprised, almost shocked... Not only because it seems to be very carefully crafted and designed, but also because it manifests several concepts, practices and intuitions that I’ve been using and gathering, and then goes way beyound that by refining and composing them into a whole, adaptable system. I so far feel blessed and lucky, because Fulcro validates my half baked tools, ideas and practices, but also because it seems to be a framework that I can build on with confidence. From what I’ve learned so far, it seems to almost completely agree with my personal experiences and challenges and teaches me a whole bunch of things on top of that. Right now I’m looking forward to build something real with it and learn what the usage assumptions are. I want to at least say “Thank you!” and “Wow!” because it is already inspiring project just from a learning perspective.

❤️ 24
Jakub Holý (HolyJak)21:12:57

Awesome, thanks for sharing! While getting your toes wet learning and using Fulcro, please make notes about hurdles and "if I only knew this 3 weeks ago.." so that we can keep on improving the beginner experience and flatten the learning curve!

tony.kay21:12:20

Thanks. You OK if I use part of that in the README? 😄 That ranks right up there with another user compliment I got: “Every sufficiently complex webapp contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Fulcro”, based on Greenspun’s tenth rule of programming.

❤️ 3
dgb2322:12:32

@U0522TWDA that’s a great suggestion. I’m teaching coding part time at a school for designers. And my guinea pig, a designer I work with closely, also takes these kind of notes for us to improve the course. The most challenging thing is to take the perspective of a beginner when you are already deeply in a subject for years. @U0CKQ19AQ Yes of course! Also that quote reflects my experience in a way :)

👍 3
🎉 3
Danny Almeida21:12:48

Hello! I have tried the example in fulcro book on dynamic routers - https://book.fulcrologic.com/#_live_router_example. Everything works as expected, but each time I select a route option, I get three messages on the console e.g. "`Will enter settings with route params {}`". Also, when I click on "`Modified (prevent routing)`" option, I get the popup message twice. This happens when I try the online book example as well as when I try it locally on my computer. Is this the expected behaviour ?

tony.kay21:12:54

it’s a poor example, actually. will-enter does get called more than once, which is part of the design (searching for the best route match), which is why will-enter has a deferred mode to prevent side effects. The double message is unintentional but also part of the routing search…The API has been improved since that example I think. @dionysius.almeida

3
tony.kay21:12:04

hard to keep book up to date:)

3
Danny Almeida23:12:07

Thank you for that clarification. Considering the effort that you make putting out and maintaining all the videos and books, it's not a small feat 🙂 Is there a better example for dynamic routing that I can maybe use ? I'm just learning routing, so it's all a bit overwhelming with all the concepts to grasp. I've just a bunch of components which get their data from the server. Now I'm trying to use routing to have multiple screens which will fetch and show data for those components. I am looking for an example which does routing along with demand based data fetching for the components. Thank you so much for being so active on this channel. Cheers

tony.kay23:12:17

Um, the RAD internals? report.cljc and form.cljc have macros that build defsc that are both route targets. They use UISM to control state, but they do use will-enter

Danny Almeida23:12:55

I haven't checked out RAD yet. I wanted to get a hang of how fulcro works under the hood before learning RAD. Will check out the files you have mentioned. Thank you again 🙂

phronmophobic22:12:44

Is there an example of using Fulcro without React? I realize that's probably not a use case that Fulcro is interested in supporting, but I'm happy to wade through the weeds a bit to see if I can reuse Fulcro's state management with a non-react view system.

tony.kay22:12:52

@smith.adriane there are not many weeds. The design is adaptable. If I had the time I would have already written a UNIX Curses plugin just to be “funny”

metal 3
tony.kay22:12:07

of course you can’t use the DOM helpers, but you don’t want to

tony.kay22:12:30

but you can plug the renderer, or just use it headless for state mgmt

tony.kay22:12:52

defsc does output a react component by default, but if you use use-hooks? true you just get a plain fn

phronmophobic22:12:04

Mostly, I just want access to the render function for a component. Is the suggested route to forgo defsc and make a similar macro?

phronmophobic22:12:15

I type too slow

tony.kay22:12:29

The hooks route might work…I type too fast 😜

tony.kay22:12:38

and tend to guess ahead of ppl 🙂

tony.kay22:12:46

(not always accurately)

tony.kay22:12:10

In CLJ or CLJS?

tony.kay22:12:19

then you can use defsc

tony.kay22:12:22

no React involved

phronmophobic22:12:46

well, ideally both, but I'm much more interested in clj since cljs already has a really good story (ie. React)

tony.kay22:12:47

I do not guarantee that works perfectly…it was meant for server-side rendering of DOM, but there are no React ties.

tony.kay23:12:07

(I don’t know anyone doing SSR with it, so not well-exercised)

tony.kay23:12:43

be fun to see what you come up with. please share your progress and questions 🙂

phronmophobic23:12:51

the use-hooks? looks like it's a great start

phronmophobic23:12:47

and already puts Fulcro ahead of the other ui frameworks I've tried that were heavily dependent on react

tony.kay23:12:03

The data stuff will run seamlessly…don’t know about the render (refresh) story…should be OK. I test in CLJC.

tony.kay23:12:20

and like I said, render is trivial and pluggable

tony.kay23:12:44

In CLJ the non-hooks “component” just let’s you put the lifecycle stuff on the component (which is just a map), but nothing calls any of it

tony.kay23:12:50

(but you can 😉 )

tony.kay23:12:43

(comp/component-options Class-or-this) is the API way to ask for the options in the options map of a defsc (contains query/ident/initial state as their real lambdas as well)

tony.kay23:12:25

So, I think all it will take is: 1. Set the app options on app creation for :render-root! and :optimized-render! 2. Have your “components” return a tree of data your render can work with 3. Pass app/mount! the app, your Root component, and a made-up keyword for mount node

tony.kay23:12:16

heck, you could start with a simple Root that prints a value and waits for input (like System/in)…on input “transact!“, and render again.

tony.kay23:12:29

should be able to get a “increment button” like thing going in 10 mins

tony.kay23:12:22

Render is essentially “Here’s the db, and here’s your root (whose query can be used to pull from db)…render stuff”. See the source for application.cljc and keyframe-render.cljc

phronmophobic23:12:09

I'm a little new to fulcro, so I'll try to work through those suggestions. I did just watch some of the videos about the underlying design which seems great

tony.kay23:12:29

Actually, if you set render-root! then you can use the unmodified keyframe-render for optimized-render

tony.kay23:12:44

so step 1 is half the work 🙂

notbad 3
tony.kay23:12:22

If you want to use remotes, you just need to define a remote, which is also pretty easy. It’s just a map with a :transmit! key whose value is a function that receives the tx to transmit and callbacks to use to report the result.

tony.kay23:12:39

I don’t have a CLJ remote pre-built…but the js source of the front-end one is a good template

phronmophobic23:12:07

my first goal is to build a simple desktop app

👍 3
phronmophobic23:12:44

nothing was happening when I tried to call app/mount! and I just peeked at the source and it looks like app/mount! doesn't have a clj implementation

phronmophobic23:12:22

I'll give writing my own version of mount! a shot based on the cljs implementation

tony.kay00:12:01

oh. funny. didn’t remember that

tony.kay00:12:07

no one has tried this yet

phronmophobic01:12:39

it works!

🎉 6
tony.kay01:12:33

see, not hard at all

tony.kay01:12:07

what UI is that using, just Swing?

wilkerlucio01:12:53

maybe JavaFX?

phronmophobic01:12:29

but it can render to a number of different targets, https://github.com/phronmophobic/membrane

phronmophobic01:12:22

right now, there's skia, swing, and terminal on desktop, but I plan on supporting javaFX at some point

tony.kay01:12:15

that is a really cool thing to combine with Fulcro

phronmophobic01:12:54

I had just about given up on integrating existing ui frameworks because, so far, they've been coupled to react

phronmophobic01:12:28

Fuclro seem great. I'm kicking myself for not trying it earlier!

JAtkins04:12:17

@ Adrian Smith Hey, if you get anywhere at all with skia lmk! I'd love to try and dogfood it with you, since I have no interest in writing more and more javafx/swing stuff and I have some projects I want to build that cannot be web based for performance reasons.

phronmophobic04:12:28

😆 , poor other "Adrian Smith" that gets mentioned for random discussions I'm in.

phronmophobic04:12:35

@U5P29DSUS, will do! I'm working on creating an example repo for a proof of concept

JAtkins05:12:02

I actually tried to get the right one... slack didn't help me out. I was hoping the first in the list would be the one which was in the same thread. Why does slack not sort by relevance?

🤷 3
phronmophobic05:12:27

it's not the first time this has happened 😁