Fork me on GitHub

hey guys, has anyone experience with using fulcro with ions? or this is silly idea and I should just use datomic cloud and deploy fulcro app on aws in regular way??


I have not tried it @sihingkk, but I’d love to hear your experience if you try it.


Looks like a lot of manual configuration (my reading of the docs indicates you have to make an API service gateway for each API call…but perhaps there’s a way to do more than one at a time?)


But then again…we only really need one endpoint: /api, so perhaps it would work quite well 🙂


I will try use it soon 🙂


For Fulcro Template the code comments say you can get rid of SSR by putting in a "resources/public/index.html" and commenting out the call to wrap-server-side-rendering. But I've found it then doesn't work. For example if I manually type in "preferences.html", even after having visited that page, then the browser comes up with "Resource not found.". So then it seems you would have to put "preferences.html" in at "resources/public" as well. And if you have to do that, well the only way to get "preferences.html" is to SSR it.


So the SSR and the browser routing stuff really go together.


@cjmurphy not sure what exactly you want to do, are you trying to serve a different app at /preferences.html


or same app but show a different part (i.e. UI routing)?


@sihingkk i wanted to use ions in my current project, would have been easier to setup and deploy, but i needed TxReportQueue, which is currently only available in the peer lib

👍 4

@cjmurphy You’re conflating two things. SSR is the process of rendering the page you want to see before the js loads. HTML5 routing has to do with letting the URI affect what the js renders. For HTML5 routing, you will need to add something to your ring stack that serves index.html for all valid routes


@currentoor Was running the fulcro template and went along with the comment "Ring middleware to handle all sends of the SPA page(s) via server-side rendering. If you want to see the client without SSR, just remove this component from the ring stack and supply an index.html in resources/public." I was just observing that you lose 'browser routing' (user decides to directly enter say preferences.html into browser url textbox) when you act on the comment. Perhaps it would be better if nothing changed in the browser url textbox as the app is being used. Then it wouldn't give the user the chance.


Yes that extra bit - add something to your ring stack that serves index.html for all valid routes - would stop the problems I see.


Hi! It seems that Fulcro generates CSS with the style of child components having more priority than their parents, in other words, the CSS classes of the children come after the CSS classes of the parents in the HTML. If that is the case you can’t change the style of a child component from its parent (if you are changing a style that is already defined in the child). Is this the correct behavior? Applying reverse here would change this behavior:


@f.o.thome i believe fulcro css is meant to contained within a component, if a parent needs to modify the styles of a child, shouldn’t it pass a (computed) prop down to the child and the child can use that to determine which styles to apply?


similar to the shadow dom with web components


localized CSS


Hi @currentoor! yes, it should. But if I understand you, that is the problem. If the css class you pass from the parent to the child comes before the css class in the child in the HTML you will not be able to change the child styles


hello simple_smile, do you mind sharing an example?


this is what i was thinking


(defsc Child [this {:keys [msg]} {:keys [style-opt]} {:keys [style1 style2]}]
  {:css [[:.style1 {:background-color "red"}]
         [:.style2 {:background-color "green"}]]}
  (dom/div {:className (case style-opt
                         1 style1
                         2 style2)}
    (dom/span msg)))

(def ui-child (prim/factory Child))

(defsc Parent [this {:keys [child style-opt]}]
  {:css-include [Child]
   :query       [:style-opt {:child (prim/get-query Child)}]}
  (ui-child (prim/computed child {:style-opt style-opt})))


the parent can adjust the styling of the child, but the definitions of the different options are still defined where they should be (inside the child)


@currentoor but that assumes the child will have all the css options, the point here is been able to extend with custom css coming from the parent


check this:

(fp/defsc Button [this props]
  {:css         [[:.button {:color "#f00"}]]
   :css-include []}
  (dom/button :.button props "x"))

(def button (fp/factory Button))

(fp/defsc Block [this _]
  {:css         [[:.custom-color {:color "#00f"}]]
   :css-include [Button]}
    (button {:classes [:.custom-color]})))

(def block (fp/factory Block))


i guess i just haven’t run into that situation, that assumption always made sense for in the context of my single app


but i can image how if you were building a UI kit then you’d want something more configurable


so i stand corrected simple_smile


thanks for the clarification @wilkerlucio


no problem 😉


hey @wilkerlucio just wanted to make sure, the Block component in your example, that wouldn’t work right?


like :classes takes in literal classes, it doesn’t resolve them to the generated fulcro CSS classes defined in :css right?


@currentoor correct, my example doens't work, to make it work the call to button must be (button {:classes [(:custom-color css)]}) instead


but still have the css issue 😉


but i kind of wish it did work 😅


that would be a nice syntax


but complicated as hell to implement, hehe


yeah i remember that discussion, we considered dynamic scope and what not


When updating from fulcrologic/fulcro "2.6.0-RC2" to fulcrologic/fulcro "2.6.0-RC7" I get this compile error: Use of undeclared Var fulcro.client.dom/fragment Was this removed?


@pontus.colliander it was moved to fulcro.client.primitives, since fragment is not specific DOM thing


aha okay, so how do I use it now? Used to write (dom/fragment)


same way, just change the namespace


(prim/fragment) if you follow the book, I like (fp/fragment), its just an alias, pick your name 🙂


okay, thanks 🙂


The book is still saying dom/fragment from what I can see though:, just so you know


Fulcro 2.6.0-SNAPSHOT is on clojars. I’ve added new CSS injection support that actually addresses @f.o.thome CSS ordering, and updated the book ( The new CSS injection also does auto-include based on the component queries…so as long as your CSS is in components with queries, you can avoid manually doing the inclusions!


@pontus.colliander Book fixed. Thanks for letting us know

👍 4