fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
exit2 2020-10-08T00:38:29.194600Z

Where are we to store static things like images and css w/in a Fulcro project?

exit2 2020-10-08T12:45:29.202600Z

@zilti Does this work only for clj? I can’t seem to get it to work for cljs. I’m basically trying to import an image from my resources/public dir

Jakub Holý 2020-10-08T20:19:37.210600Z

Uh? Import an image into what becomes Javascript file at build time? Or load it at run tine? If the latter - use <img href=<server url>>, make sure there is a static resources Middleware

Jakub Holý 2020-10-08T20:20:23.210800Z

Shadow-cljs has some built in stuff for embedding resources at build time but works only for a few types

Mr. Savy 2020-10-08T00:49:57.194700Z

typically under the resources directory

exit2 2020-10-08T00:51:37.194900Z

is there any easy way to access that path?

Mr. Savy 2020-10-08T01:09:00.195100Z

i think that depends on how you want to/are trying to/should try to access it

zilti 2020-10-08T01:09:10.195300Z

When you have it in your :paths vector in deps.edn, you can access it using io/resource. So if it is in resources/test.css, it'd be (io/resource "test.css")

1👍
Mr. Savy 2020-10-08T04:29:13.201700Z

yoooooo I, like, halfway got it. @cjmurphy thanks for your suggestion earlier. I got it working with the local state that I had already set up, so I think I understand it well enough now. Here's what I'm threw together.

(defmutation toggle [{:keys [id]}]
  (action [{:keys [state] :as env}]
      (swap!-&gt; state
         (update-in [:button/id id :button/num]
                    #(if (= %1 1) 0 1))
         (update-in [:sidebar-contents/id 2 :sidebar-contents/state]
                    #(if (= %1 1) 0 1)))))
the button case works fine, but the same can't be said for the sidebar case. although, it does work if I hard code the id and that works for me; for now anyways.

exit2 2020-10-08T13:00:14.204200Z

Is it because the id for the button isn’t the same as the id for the sidebar-contents?

cjmurphy 2020-10-08T13:59:31.204400Z

The id is just a parameter that comes from the UI (i.e. from inside the render of a component).

1👍
Mr. Savy 2020-10-08T22:23:10.211600Z

I had the same id for both for testing purposes. That's a good catch though exit2. Does every id of every component have to be different?

cjmurphy 2020-10-08T22:34:51.212100Z

@ajsnow2012 Think in terms of idents not components. Many component instances may share an ident - which is a row of information, like an individual person for instance. The answer to your question is 'no'. But really there's no such thing as an id of a component.

Mr. Savy 2020-10-08T22:55:50.212400Z

hmmm, ok. I think that makes sense, thanks!

2020-10-08T05:06:01.201800Z

@tony.kay confirmed, works with 3.0.1.

1👍
Adrian Smith 2020-10-08T08:54:03.202Z

I figured this out in the end so I recommend installing this: https://github.com/seancorfield/dot-clojure/blob/develop/deps.edn (read the readme inside the repo) then you can do clj -A:dev:datomic:nrepl you can also add other cool things like :rebl, I recommend reading all the aliases in that file

exit2 2020-10-08T12:45:29.202600Z

@zilti Does this work only for clj? I can’t seem to get it to work for cljs. I’m basically trying to import an image from my resources/public dir

exit2 2020-10-08T13:00:14.204200Z

Is it because the id for the button isn’t the same as the id for the sidebar-contents?

cjmurphy 2020-10-08T13:59:31.204400Z

The id is just a parameter that comes from the UI (i.e. from inside the render of a component).

1👍
exit2 2020-10-08T17:34:43.205800Z

I’m trying to use the interop/react-factory fn to wrap material-ui components but I keep getting odd errors like:

exit2 2020-10-08T17:35:02.206100Z

> Warning: Invalid value for prop $$typeof on <div> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM. For details, see

exit2 2020-10-08T17:37:02.207100Z

(:require ["@material-ui/core/Container" :default Container])

(def ui-container (interop/react-factory Container))

(ui-container (dom/div "Blah")) ;; etc..

2020-10-08T17:47:46.208Z

You can make a similar helper that is more convenient, e.g.: https://github.com/dvingo/my-clj-utils/blob/master/src/main/dv/fulcro_util.cljs#L104

1👍
Luis Santos 2020-10-08T18:39:31.209900Z

Is there anything similar to Fulcro in the Javascript ecosystem? Was Fulcro inspired by some framework out there? I'm talking about the it handles data, relations and revolvers. The way it handles separation of state, view and mutations feels familiar but everything else feels unique. It has similarities with GraphQL.

Jakub Holý 2020-10-17T12:16:54.316700Z

Fun fact: I have mostly finished a transcript of my DevFest Norway talk about Fulcro and JS alternatives https://blog.jakubholy.net/2020/talk-want-more-from-your-frontend-framework/

Jakub Holý 2020-10-08T20:16:16.210200Z

Clarification - Michael means "pathom on the client side"

Jakub Holý 2020-10-08T20:16:56.210400Z

I'm offline but look how it is used in the source code

Jakub Holý 2020-10-08T20:19:37.210600Z

Uh? Import an image into what becomes Javascript file at build time? Or load it at run tine? If the latter - use <img href=<server url>>, make sure there is a static resources Middleware

Jakub Holý 2020-10-08T20:20:23.210800Z

Shadow-cljs has some built in stuff for embedding resources at build time but works only for a few types

Jakub Holý 2020-10-08T20:26:42.211300Z

Not really, I believe. The closest is https://relay.dev regarding graph api, query on component, normalized client side cache

1👍
Mr. Savy 2020-10-08T22:23:10.211600Z

I had the same id for both for testing purposes. That's a good catch though exit2. Does every id of every component have to be different?

cjmurphy 2020-10-08T22:34:51.212100Z

@ajsnow2012 Think in terms of idents not components. Many component instances may share an ident - which is a row of information, like an individual person for instance. The answer to your question is 'no'. But really there's no such thing as an id of a component.

Mr. Savy 2020-10-08T22:55:50.212400Z

hmmm, ok. I think that makes sense, thanks!