Fork me on GitHub
#fulcro
<
2019-01-02
>
Björn Ebbinghaus10:01:52

@tony.kay I get this error:

Use of undeclared Var fulcro-css.css-implementation/garden
 141 |   [x]
 142 |   (try
 143 |     #?(:clj  (= garden.selectors.CSSSelector (type x))
 144 |        :cljs (= garden.selectors.CSSSelector (type x)))
 145 |     (catch #?(:cljs :default :clj Throwable) e
 146 |       false)))
 147 | 
 148 | (defn get-selector-keywords
I don't even use flucro-css garden 1.3.6 is installed.

pauld14:01:08

Where can I find an example of using fulcro with pathom?

pauld14:01:11

In particular, I'm wondering how to use pathom-remote instead of fulcro-http-remote while still being able to set the api endpoint and :request-middleware.

pauld14:01:56

ok, I see that I misunderstood. I don't need to stop using fulcro-http-remote since I'm using pathom on server side.

tony.kay15:01:38

@mroerni you sure that is an error? Should be a warning if you don’t have garden on the path

wilkerlucio15:01:23

@tony.kay @mroerni I just got the same warning, not an error, just annoying

tony.kay15:01:28

yes, the warning cannot be eliminated without needlessly bloating programs that don’t use garden

Alex K20:01:23

Hi all. I'm doing my first project with Fulcro at the moment, so first off, thanks Tony for all the work you've put into this. The more I do, the more I appreciate how many potential problems are solved already. I'm a little confused with regard to the automatic normalization. Say I have a component Person, and I want to see how it looks with a couple of different people entities from the server. I make a Root component to pass into ws/defcard. Its query is [:root/person (prim/get-query Person)], and it has an ident [:person/by-id :person/id]. In ws/defcard I use df/load in the :started-callback: (df/load [:person/id 42] Person {:target [:root/person]}). This issues a query [{[:person/id 42] [:person/id :person/full-name]}], which comes back as {[:person/id 42] {:person/id 42 :person/full-name "John Smith"}}, which is loaded into the root of the client database as is, with :root/person pointing to [:person/id 42]. So if I understand properly, because the data is loading in as a join to the ident rather than just the person attribute map, it won't normalize properly. So I'm wondering if I'm supposed to hand-normalize this with a post mutation, or am I going about this wrong?

tony.kay20:01:32

The normalization on an ident query will work fine

tony.kay20:01:48

but the ident-based query, of course, will not update the :root/person link

tony.kay20:01:08

The only way normalization breaks is if you fail to use a component to make the query

tony.kay20:01:35

but load typically makes you use a component, so normalization is fine…

Alex K20:01:24

Hmm. Isn't the :root/person link getting updated by the :target in load? The example I gave is a pared down version of what I have. Sticking with the example version, I'm ending up with a tree of :person attributes under the key :person/id 42 in the root of the client db. :root/person contains just the ident, which I presume :target has done, but the only :person/by-id I have has just appeared when I added in a form config. Sorry if I'm being dense.

tony.kay21:01:15

Ah, yes, missed you’re use of target

tony.kay21:01:05

I’m not sure what you’re saying is going wrong. You’re saying that the new data isn’t ending up in the table?

tony.kay21:01:14

so you’re getting an ident as a key in root?

tony.kay21:01:34

You should have {:person/id {42 {…person props}}}

tony.kay21:01:16

I’m not aware of the normalization being broken in any way with that use-case.

Alex K21:01:36

Yeah, I was expecting it would end up as {:person/by-id {42 {..., but it's ending up as {:person/id {42 {.... I may have the wrong idea. I watched your videos, and the only real difference between your todo-list example and this is that you were loading by an invented keyword which you parsed on the server (IIRC), and I'm trying to load a specific ident and shove it under an invented keyword with :target.

Björn Ebbinghaus21:01:14

@tony.kay Hey, I currently have some problems with routing to pages which require data from my remote to be loaded. I am trying to trigger a load and then nav-to! the page. This does not work. Not even, if I load the page way in advance. (I merge to the respecting id of the page.) So, how do I load a page with a dynamic id, which isn't loaded beforehand?

tony.kay22:01:22

@mroerni not sure what you’re running into. Data does have to be in local db for UI to display (otherwise the query finds nothing)…typically you put some placeholder in place of what you will load so that the query returns something (to render), and then the refresh on load updates. The standard router is nothing more than a unino query component that follows the query based on the ident you’ve given it. See the book demos..there are a number that do similar things.

tony.kay22:01:38

There is a routing one that loads “settings” I think

tony.kay22:01:13

The second one does routing and loading

Björn Ebbinghaus22:01:53

The example uses the old defrouter instead of defsc-router. And the id (:a) is set in the initial state.

tony.kay22:01:38

Do I have an oversight with the new router?

tony.kay22:01:55

You should have initial state on your components that you route to…not sure what you’re getting at…the new notation should cover that example fine

Björn Ebbinghaus22:01:42

But how do I set the correct id in the initial state? I don't know which ids I have beforehand. And I don't see how I can pass them from the router. 😕

Björn Ebbinghaus22:01:42

I have to look at his tomorrow. It is already midnight over here.