This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-19
Channels
- # aws-lambda (4)
- # beginners (62)
- # cider (20)
- # cljs-dev (9)
- # cljsrn (13)
- # clojars (3)
- # clojure (105)
- # clojure-brasil (1)
- # clojure-denver (1)
- # clojure-finland (4)
- # clojure-italy (23)
- # clojure-norway (1)
- # clojure-spec (6)
- # clojure-uk (56)
- # clojurescript (41)
- # cursive (10)
- # datomic (25)
- # emacs (23)
- # figwheel (2)
- # fulcro (133)
- # graphql (12)
- # hoplon (32)
- # instaparse (13)
- # keechma (1)
- # lein-figwheel (1)
- # luminus (1)
- # lumo (1)
- # nyc (2)
- # off-topic (34)
- # om (2)
- # onyx (10)
- # pedestal (8)
- # portkey (1)
- # re-frame (10)
- # reagent (26)
- # ring (8)
- # shadow-cljs (77)
- # spacemacs (4)
- # sql (8)
- # tools-deps (15)
- # vim (9)
Hi all, from a marketing perspective - would there be much to gain for fulcro to submit an app to this? https://medium.freecodecamp.org/a-real-world-comparison-of-front-end-frameworks-with-benchmarks-2018-update-e5760fb4a962
(I note fulcro would potentially have an even better story to tell regarding serverside, CSS and the inspector).
yeah, fulcro will definitely shine there
with the upcoming version of walkable, realworld's server side can be done easily
we can implement client only with their REST spec, but I suggest a fullstack app
Yes I think fulcro would indeed do best with a fullstack app! But it seems that the boundaries set by this challenge is that any frontend should be able to communicate with any backend.
I think it's not the case. For instance a frontend app that expect a REST api won't work with a graphql api implementation
You are right. I think the original idea was to all use the same REST api as the headline says ‘See how the exact same http://Medium.com clone (called Conduit) is built using any of our supported frontends and backends. Yes, you can mix and match them, because they all adhere to the same API spec 😮😎‘’, But I see now that they also have a fullstack category 😄 https://github.com/gothinkster/realworld#fullstack . I’d be interested to help out!
oh that's is great! I have a REST version here built with Walkable. Most of the dev time was spent on routing! Converting to fulcro server should be trivial https://github.com/walkable-server/realworld
please create the client side app, I will take care of the server side
it was to you. However, other people seem to be not interested in this? 😮
would you like to make that app? @U0JTK6WS2
I would love to but unfortunately I currently lack the necessary skills, confidence and time. (My day job is rails / SQL and I am dabbling with Clojure[script] only as a side project). Apologies for getting anyone’s hopes up - I was hoping to arouse enthusiasm from the more knowledgeable crowd (who also are time squeezed but would be 100x as productive) because I thought it would be a great showcase for fulcro’s advantages.
no worries, it took me quite some time to understand fulcro. Don't rush, take small steps and we will get there. People here are eager to help 🙂
hi @tony.kay and @thheller, trying to run shadow-cljs release main
with :infer-externs :auto
. I’m getting a lot of warnings about shadow not being able to infer fulcro stuff. Is this expected behavior, and if not, is there something that can be done about this?
@levitanong do you have fulcro sources in your project? :auto
will only warn for actual files you have in your classpath (not files in jars).
@thheller not at all. The warnings seem to be all about the lifecycle stuff in fulcro:
Cannot infer target type in expression (. this__27552__auto__ initLocalState)
Cannot infer target type in expression (. (. Sidebar fulcro.client.primitives/-prototype) fulcro.client.primitives/-fulcro$isComponent)
also, another funny thing:
------ WARNING #1 --------------------------------------------------------------
File: ~/.m2/repository/org/clojure/clojurescript/1.10.238/clojurescript-1.10.238.jar!/cljs/core.cljs:11505:17
--------------------------------------------------------------------------------
11502 | (enable-console-print!)
11503 |
11504 | (identical? *target* "nashorn")
11505 | (let [system (.type js/Java "java.lang.System")]
-----------------------^--------------------------------------------------------
variable Java is undeclared
--------------------------------------------------------------------------------
11506 | (set! *print-newline* false)
11507 | (set-print-fn!
11508 | (fn []
11509 | (let [xs (js-arguments)
--------------------------------------------------------------------------------
yay! so the fulcro thing, is it even possible to fix this?
I see, I guess we’ll have to see if this is something @tony.kay wants to do 😛
by the way, really loving your release-snapshot
. I’m thinking about making a visualizer for this.
@steveb8n wants to write a tree-map visualization for that as well. @alex-dixon also expressed interest in building something. https://github.com/thheller/shadow-cljs/issues/247
oh great! i don’t have to build anything then! 😄
hehe maybe talk to them if you have ideas but yeah there might be stuff coming soon already 🙂
👌 @steveb8n please link me the repo when you have something, and I can just take a look at your issue list to see what needs doing. 😄
Anyone integrate Material UI with fulcro? I have it mostly working but my text fields lose focus when I set-string! them,
@claudiu SSR and dynamic queries: should work perfectly..just need to remember to pass state (with the updated queries) to get-query
at the root
@levitanong glad to add type hints…would appreciate help. Kind of busy these days
@christopher.rosengren You just using CSS, or some js-y things?
@tony.kay Most be missing something. I added the state exactly as the frontend state (frontend works with just initial state from html). But on server it does not render my page component 😞 Behaves the same as if on the client I comment out (defmethod r/get-dynamic-router-target :main [k] Main)
your server has to do the same…call set-query*
on your server built state, then pass that updated state to get-query
.
You are making sure that your server code requires all of the dynamic modules you’re trying to render from?
I imported the router and the ui.root (where I have 3 components like in dynamicUiRouting from the book)
otherwise it cannot reach them because they are not registered…the client dynamic router code loads them, which registers them. On the server, you have to load them
Does the server also add metadata in the state ? I'm building the state a bit strangely... a bit of copy paste from fulcro-inspect
normalized-state (cond-> base-state
true (r/add-route-state :main root/Main)
true (prim/set-query* (prim/factory root/Main) {:query (prim/get-query root/Main)})
true (assoc-in
[:fulcro.client.routing.routers/by-id :top-router :fulcro.client.routing/current-route]
[:main :singleton])
true (#(prim/set-query*
%
(prim/factory r/DynamicRouter {:qualifier :top-router})
{:query [
:fulcro.client.routing/id
:fulcro.client.routing/dynamic
{:fulcro.client.routing/current-route
"project.ui.root/Main"}]}))
@claudiu so, the client and server code are cljc for most of this…it is the same code
instead of using things like assoc-in
, I think there are helpers in router namespace for setting the route
seems to work. I am doing something wrong when generating the app-state on the server I get current-route: [:main :singleton]
instead of the query 🙂
but does rote-to-impl! work on server ? seems to require a reconciler and in the docs says I should work set-query* to workaround
your code is really hard to read, because you put it in a thread…and it is wrapping like crazy
Yep, sry. Got it working a bit by sending what the client sends to top-router while we were talking
(cond-> base-state
true (r/add-route-state :main Main)
true (prim/set-query* (prim/factory Main) {:query (prim/get-query Main)})
true (assoc-in
[:fulcro.client.routing.routers/by-id :top-router :fulcro.client.routing/current-route]
[:main :singleton])
true (#(prim/set-query*
%
(prim/factory r/DynamicRouter {:qualifier :top-router})
{:query [
:fulcro.client.routing/id
:fulcro.client.routing/dynamic
{:fulcro.client.routing/current-route
"project.ui.root/Main"}]})))
Could not really figure out if there's a easy way to set the dynamic-query for the router after I add the current-route ident 😞
ahh 🙂 also have if loggedin and a few other there, that I removed from the copy/paste. Like in https://github.com/fulcrologic/fulcro-template/blob/master/src/main/fulcro_template/server.clj#L102
Yep. But by pasting the query directly into the state. Now just have to figure out how to generate that state 🙂
After I add the current route, is there a method that I missed that generates this in app state
:fulcro.client.primitives/queries ▶ {"fulcro.client.routing/DynamicRouter$:top-router
` ?@njj history went through a complete rewrite. It has not been heavily used, but it is no longer indexed quite the same. Don’t remember off the top of my head.
prim/get-history
is what you want for getting this current history, then make a history navigator
Hello! , I’m starting to learn about Fulcro and Fulcro SQL so I hope this question makes sense. It is clear to me from the documentation how to integrate with a Fulcro server and how reads and mutations receive the DB manager.
I have an external method (so no read nor mutation) in my app that has to do some insertions in the DB. I thought that it would be cool to use the DB Manager registered with the server so I don’t have to worry about configuration, for example. Is there any way to get an instance of my DB Manager in my function?.
I was thinking
(defn myfn []
(let [dbs (some-way-to-get-it)] ; This db manager would already be reading from the right environment, etc.
(let [dbspec (fulcro-sql.core/get-dbspec dbs :mydb)]
(jdbc/insert! dbspec ...))))
I mean, does the idea make sense?@tony.kay ha, turns out the function that uses from-history
isn’t used anywhere. So no worries for now 😄
@jacob.mendoza your code needs to run in the same process, right? So, your function needs to be called from a component of the server. Therefore: inject the db manager into that component, and then pass it to that function.
your only other option is to access the atom holding your system, and pull it out of there once the system is started
You could add a simple component whose “start” method calls your function if this is startup code, etc.
> So, your function needs to be called from a component of the server. Therefore: inject the db manager into that component, and then pass it to that function. Oh, that really seems like the way to go. Still discovering things, I haven’t thought about that before. Thank you so much @tony.kay, let’s try to see if I can make it work!.
it’s just component/using
for injection, and a defrecord
that implements lifecycle 🙂
@tony.kay I found that load-data
was moved to load
, when renaming I seem to be running into some issues. (df/load reconciler [:web-env :env-vars :login-profile] :marker false)
but when putting it in a map, a new error arises Uncaught Error: Assert failed: (or (util/ident? server-property-or-ident) (keyword? server-property-or-ident))
yeah I found this, https://github.com/fulcrologic/fulcro/search?utf8=%E2%9C%93&q=load-data&type=
So, your specific example should now be written as 3 loads, or using the internal mutation if you must have a custom query
I'm seeing (reconciler? reconciler) fail with latest release, cljs 1.10. is this known issue? There was a similar problem with om, I think it had to do with new map-entries
(js/console.log :r? (prim/reconciler? (-> this prim/get-reconciler)))
inside of a component shows “:r? true” in the console
Is there an easy-ish way to use react components from an arbitrary npm package?
@tony.kay Still no luck with generating the dynamic query correct state on server to get it working. 😞 Tried to get a simple non-working example here https://gist.github.com/claudiu-apetrei/f22000f7721b6f7b56f5f89797cbc083
You are right. I think the original idea was to all use the same REST api as the headline says ‘See how the exact same http://Medium.com clone (called Conduit) is built using any of our supported frontends and backends. Yes, you can mix and match them, because they all adhere to the same API spec 😮😎‘’, But I see now that they also have a fullstack category 😄 https://github.com/gothinkster/realworld#fullstack . I’d be interested to help out!
oh that's is great! I have a REST version here built with Walkable. Most of the dev time was spent on routing! Converting to fulcro server should be trivial https://github.com/walkable-server/realworld