This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-19
Channels
- # announcements (5)
- # beginners (68)
- # boot (1)
- # cider (27)
- # clara (11)
- # cljdoc (10)
- # clojure (129)
- # clojure-europe (2)
- # clojure-italy (16)
- # clojure-nl (15)
- # clojure-spec (74)
- # clojure-uk (31)
- # clojurescript (62)
- # core-async (17)
- # cursive (28)
- # datomic (22)
- # duct (29)
- # emacs (10)
- # fulcro (65)
- # hoplon (2)
- # hyperfiddle (16)
- # instaparse (3)
- # kaocha (2)
- # lein-figwheel (3)
- # leiningen (1)
- # mount (1)
- # nrepl (21)
- # off-topic (23)
- # re-frame (59)
- # reitit (18)
- # ring-swagger (2)
- # shadow-cljs (2)
- # spacemacs (16)
- # timbre (2)
- # tools-deps (22)
@currentoor Thanks for the in depth example. Both yours and the books examples seem to have the idents backwards, to my beginner’s eye. :tab
is constant, the front bit seems to be the id, so I’d want to do [:TABS/by-id :ucv.ui.foo]
, to keep the tab definitions go inside a tidy table. Is the point of this to leave open to extension a different type of view than :tab
for each ui component?
@sooheon you’re welcome
so the problem with what you’re saying > to keep the tab definitions go inside a tidy table is this means all the tabs need to be similar, since they are all in the same table and they would need to all have a similar query structure
but they are very different, some have sub-routers, some have other sub-components
typically they are very different
that said, if you look at your app-state in the inspector, or the DB view in the book, you’ll see all these tab idents are neatly placed inside the router’s table
Weird though, I think my app has a :COMPONENT/by-id
table with components that have very different shapes
:fulcro.client.routing/routing-tree
in you app are actually calling it :COMPONENT/by-id
?
I guess that only works while the initial-state is provided per component, but would break down with loads based on component class?
it should be something more specific like :account/by-id
and :person/by-id
i’m guessing you’ve used SQL databases before right?
it’s just like that, you want to store separate models in separate tables
rather than have one giant table for all your schema
think of :account/by-id
as the name of a table
in fact you could totally called it :accounts
or :account/table
normalized db is the default DB, like SQL, that everyone uses on the backend all the time without batting an eye
except people aren’t used to using it on the frontend 😅
even though it has a lot of the same benefits
yeah exactly they’re easy, until you have more than one view of some piece of data
then you have to do backflips to keep your data consistent
@currentoor @sooheon So, the ident order. I regularly use :COMPONENT/by-id
for singleton components, and @sooheon you are right the router ones “look” backwards. I’d prefer they all go in the same table as well if they are singletons, but unfortunately the real issue has to do with union queries. The router component in Fulcro is more about optimization that routing to be honest. You want a union query to ensure the query stays fast, but unions SWITCH on the FIRST component of the ident..thus, THAT is the part that has to vary,
If you want more details on this, watch this video: https://www.youtube.com/watch?v=HJBI24yAdBQ&t=612s&index=12&list=PLVi9lDx-4C_Rwb8LUwW4AdjAu-39PHgEE
hmm interesting, i always thought of tables as database tables, but yeah i suppose you could put all singletons in one table
yeah, the routers work the way they do to optimize the query…and that is the primary reason I added defrouter
…it is the most optimal way to switch UI while optimizing query overhead
either that or dynamic queries (which would support it the other way around), but the Om Next code (when we were using Om Next) for dynamic queries isn’t quite fully fleshed out. I’ve since fixed that in Fulcro, but dynamic queries are relatively untested compared to the rest of the system.
https://github.com/fulcrologic/fulcro/blob/develop/src/main/fulcro/websockets/components/channel_server.clj#L17-L19 this looks like it prevents having several component instances
I too am curious about it. Because Pedestal is also an option to use.
Looks like you have to create an alternate network and use pathom for a nice integration http://book.fulcrologic.com/#_a_rest_example
looks like passing the sente aleph adapter for websockets is necessary. There is no such thing for pedestal. And reimplementing the ring middlewares as yada interceptors. I don’t think that’s a lot of work
making it REST is another option, although more work and with little benefits. Maybe that would be the way to go for pedestal since there is no sente adapter.
Hi, coming back to cljs after a long hiatus. Getting to know fulcro. (I've used om.next a little when it was starting). Trying to understand the fulcro template. One question: What is the benefit of shadow-cljs.edn integration with leininingen since the :cljs config there is so small ?
hello geraldo, shadow has very nice tooling, the compilation is faster than the alternatives and it has the big plus that you can actually use npm libs directly, no other cljs build tool does that as well today
@U066U8JQJ but the opposite. what is the gain of leiningen integration ?
ah, with lein, not much, to me today lein is only useful to build jars, I avoid it when I can
That's the point. I've tried tools.dep without lein and got stuck on a tools.dep nrepl client. So It looks like repl-y is the thing that forces me to stay with lein. So I've started to study fulcro. That uses lein. But the repl that shadow-cljs brings does not have the tab expansion repl-y has. So I assume it's different. That leads to the question what does leiningen brings to the table ?
If nothing I tend use shadow-cljs with tools.dep and let lein out of it.
@U0516053R The main benefit is the depstar doesn’t do a great uberjar yet…not AOT or manifest
I personally also use a couple of other lein plugins that don’t have equivalents, but a pure tools.deps project is fine…
I’d make it an option of the lein template, but I don’t have time to write it, test it, etc.
@U0CKQ19AQ I see. Thank you.
@U0CKQ19AQ does some of the benefits you've enlisted relates directly with cljs?
that's very nice to hear
I’m trying to make time to port the projects all to deps…but deps is all still alpha, no windows support…so still not necessarily the best idea to have deps in the template yet 😜
devs use windows. pedestal is linux compatible. it's wise to be compatible with windows since, fulcro's stack uses ring.
at work we are stuck with windows 32 bits
I use ubuntu but cant teach them cljs because lumo does not have 32 bits 😞 . I've got very impressed by the speed it boots.